spec/jwt/access_token_spec.rb in twilio-ruby-5.0.0.rc23 vs spec/jwt/access_token_spec.rb in twilio-ruby-5.0.0.rc24
- old
+ new
@@ -25,11 +25,11 @@
payload, _ = JWT.decode scat.to_s, 'secret'
expect(payload['grants']).to eq({'identity' => 'test-identity'})
end
it 'grants during initialization' do
- room_grant = Twilio::JWT::VideoGrant.new
+ room_grant = Twilio::JWT::AccessToken::VideoGrant.new
room_grant.room = 'RM123'
grants = [room_grant]
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123', 'secret', grants
payload, _ = JWT.decode scat.to_s, 'secret'
expect(payload['grants'].count).to eq(1)
@@ -40,11 +40,11 @@
before :each do
@scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123', 'secret'
end
it 'IpMessaging grant' do
- ip_messaging_grant = Twilio::JWT::IpMessagingGrant.new
+ ip_messaging_grant = Twilio::JWT::AccessToken::IpMessagingGrant.new
ip_messaging_grant.service_sid = 'SS123'
ip_messaging_grant.endpoint_id = 'EP123'
ip_messaging_grant.deployment_role_sid = 'DR123'
ip_messaging_grant.push_credential_sid = 'PC123'
@scat.add_grant(ip_messaging_grant)
@@ -55,11 +55,11 @@
expect(payload['grants']['ip_messaging']['push_credential_sid']).to eq('PC123')
expect(payload['grants']['ip_messaging']['deployment_role_sid']).to eq('DR123')
end
it 'Voice grant' do
- voice_grant = Twilio::JWT::VoiceGrant.new
+ voice_grant = Twilio::JWT::AccessToken::VoiceGrant.new
voice_grant.outgoing_application_sid = 'AP123'
voice_grant.outgoing_application_params = {:foo => 'bar'}
voice_grant.push_credential_sid = 'PC123'
voice_grant.endpoint_id = 'EP123'
@scat.add_grant(voice_grant)
@@ -70,40 +70,40 @@
expect(payload['grants']['voice']['push_credential_sid']).to eq('PC123')
expect(payload['grants']['voice']['endpoint_id']).to eq('EP123')
end
it 'Sync grant' do
- sync_grant = Twilio::JWT::SyncGrant.new
+ sync_grant = Twilio::JWT::AccessToken::SyncGrant.new
sync_grant.service_sid = 'SS123'
sync_grant.endpoint_id = 'EP123'
@scat.add_grant(sync_grant)
payload, _ = JWT.decode @scat.to_s, 'secret'
expect(payload['grants'].count).to eq(1)
expect(payload['grants']['data_sync']['service_sid']).to eq('SS123')
expect(payload['grants']['data_sync']['endpoint_id']).to eq('EP123')
end
it 'Conversations grant' do
- conversation_grant = Twilio::JWT::ConversationsGrant.new
+ conversation_grant = Twilio::JWT::AccessToken::ConversationsGrant.new
conversation_grant.configuration_profile_sid = 'VS123'
@scat.add_grant(conversation_grant)
payload, _ = JWT.decode @scat.to_s, 'secret'
expect(payload['grants'].count).to eq(1)
expect(payload['grants']['rtc']['configuration_profile_sid']).to eq('VS123')
end
it 'Room grant' do
- room_grant = Twilio::JWT::VideoGrant.new
+ room_grant = Twilio::JWT::AccessToken::VideoGrant.new
room_grant.room = 'RM123'
@scat.add_grant(room_grant)
payload, _ = JWT.decode @scat.to_s, 'secret'
expect(payload['grants'].count).to eq(1)
expect(payload['grants']['video']['room']).to eq('RM123')
end
it 'TaskRouter grant' do
- task_router_grant = Twilio::JWT::TaskRouterGrant.new
+ task_router_grant = Twilio::JWT::AccessToken::TaskRouterGrant.new
task_router_grant.workspace_sid = 'WS123'
task_router_grant.worker_sid = 'WK123'
task_router_grant.role = 'worker'
@scat.add_grant(task_router_grant)
payload, _ = JWT.decode @scat.to_s, 'secret'
@@ -112,13 +112,13 @@
expect(payload['grants']['task_router']['worker_sid']).to eq('WK123')
expect(payload['grants']['task_router']['role']).to eq('worker')
end
it 'multiple grants' do
- room_grant = Twilio::JWT::VideoGrant.new
+ room_grant = Twilio::JWT::AccessToken::VideoGrant.new
room_grant.room = 'RM123'
@scat.add_grant(room_grant)
- task_router_grant = Twilio::JWT::TaskRouterGrant.new
+ task_router_grant = Twilio::JWT::AccessToken::TaskRouterGrant.new
task_router_grant.workspace_sid = 'WS123'
@scat.add_grant(task_router_grant)
payload, _ = JWT.decode @scat.to_s, 'secret'
expect(payload['grants'].count).to eq(2)
expect(payload['grants']['video']).not_to be_nil