spec/jwt/client_capability_spec.rb in twilio-ruby-5.0.0.rc22 vs spec/jwt/client_capability_spec.rb in twilio-ruby-5.0.0.rc23

- old
+ new

@@ -21,63 +21,63 @@ end it 'OutgoingClientScope sans params, client name' do @outgoingScope = Twilio::JWT::OutgoingClientScope.new('test-application-sid') @clientCapability.add_scope(@outgoingScope) - escope = 'scope:client:outgoing?appSid%3Dtest-application-sid' + escope = 'scope:client:outgoing?appSid=test-application-sid' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'OutgoingClientScope with client-name' do @outgoingScope = Twilio::JWT::OutgoingClientScope.new('test-application-sid', 'test-client-name') @clientCapability.add_scope(@outgoingScope) - escope = 'scope:client:outgoing?appSid%3Dtest-application-sid%26clientName%3Dtest-client-name' + escope = 'scope:client:outgoing?appSid=test-application-sid&clientName=test-client-name' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'OutgoingClientScope with params' do @outgoingScope = Twilio::JWT::OutgoingClientScope.new('test-application-sid', nil, {'params_key'=>'param_value'}) @clientCapability.add_scope(@outgoingScope) - escope = 'scope:client:outgoing?appSid%3Dtest-application-sid%26appParams%3Dparams_key%3Dparam_value' + escope = 'scope:client:outgoing?appSid=test-application-sid&appParams=params_key%3Dparam_value' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'IncomingClientScope' do @incomingScope = Twilio::JWT::IncomingClientScope.new('test-client-name') @clientCapability.add_scope(@incomingScope) - escope = 'scope:client:incoming?clientName%3Dtest-client-name' + escope = 'scope:client:incoming?clientName=test-client-name' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'EventStreamScope sans filters' do @eventStreamScope = Twilio::JWT::EventStreamScope.new @clientCapability.add_scope(@eventStreamScope) - escope = 'scope:stream:subscribe?path%3D%2F2010-04-01%2FEvents' + escope = 'scope:stream:subscribe?path=%2F2010-04-01%2FEvents' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'EventStreamScope with filters' do @eventStreamScope = Twilio::JWT::EventStreamScope.new({'param_key'=>'param_value'}) @clientCapability.add_scope(@eventStreamScope) - escope = 'scope:stream:subscribe?param_key%3Dparam_value%26path%3D%2F2010-04-01%2FEvents' + escope = 'scope:stream:subscribe?path=%2F2010-04-01%2FEvents&params=param_key%3Dparam_value' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'OutgoingClientScope and IncomingClientScope' do @outgoingScope = Twilio::JWT::OutgoingClientScope.new('test-application-sid') @clientCapability.add_scope(@outgoingScope) @incomingScope = Twilio::JWT::IncomingClientScope.new('test-client-name') @clientCapability.add_scope(@incomingScope) - escope = 'scope:client:outgoing?appSid%3Dtest-application-sid scope:client:incoming?clientName%3Dtest-client-name' + escope = 'scope:client:outgoing?appSid=test-application-sid scope:client:incoming?clientName=test-client-name' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end it 'complete payload' do @incomingScope = Twilio::JWT::IncomingClientScope.new('test-client-name') @clientCapability.add_scope(@incomingScope) payload, _ = ::JWT.decode @clientCapability.to_s, 'authToken', true, {:algorithm=>'HS256'} - escope = 'scope:client:incoming?clientName%3Dtest-client-name' + escope = 'scope:client:incoming?clientName=test-client-name' expect(payload['iss']).to eq('accountSid') expect(payload['scope']).to eq(escope) expect(payload['exp']).to be > Time.now.to_i expect(payload['nbf']).to be <= Time.now.to_i end @@ -85,10 +85,10 @@ describe 'ClientCapability constructor with scopes' do it 'Valid scopes in constructor' do @incomingScope = Twilio::JWT::IncomingClientScope.new('test-client-name') @clientCapability = Twilio::JWT::ClientCapability.new 'accountSid', 'authToken', scopes: [@incomingScope] - escope = 'scope:client:incoming?clientName%3Dtest-client-name' + escope = 'scope:client:incoming?clientName=test-client-name' expect(@clientCapability.__send__(:_generate_payload)[:scope]).to eq(escope) end end end \ No newline at end of file