Beispiel #1
0
 def test_test_restore_state_with_separate_backends(self):
     openid_backend_1 = OpenIdBackend(MagicMock, INTERNAL_ATTRIBUTES, TestConfiguration.get_instance().config)
     openid_backend_2 = OpenIdBackend(MagicMock, INTERNAL_ATTRIBUTES, TestConfiguration.get_instance().config)
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     context = Context()
     context.state = State()
     openid_backend_1.start_auth(context, None)
     context = self.setup_fake_op_endpoints(FakeOP.STATE)
     openid_backend_2.redirect_endpoint(context)
Beispiel #2
0
 def test_test_restore_state_with_separate_backends(self):
     openid_backend_1 = OpenIdBackend(
         MagicMock, INTERNAL_ATTRIBUTES,
         TestConfiguration.get_instance().config)
     openid_backend_2 = OpenIdBackend(
         MagicMock, INTERNAL_ATTRIBUTES,
         TestConfiguration.get_instance().config)
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     context = Context()
     context.state = State()
     openid_backend_1.start_auth(context, None)
     context = self.setup_fake_op_endpoints(FakeOP.STATE)
     openid_backend_2.redirect_endpoint(context)
Beispiel #3
0
 def test_redirect_endpoint_returned_correct_object_types(self):
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     openid_backend = OpenIdBackend(verify_object_types_callback,
                                    INTERNAL_ATTRIBUTES,
                                    TestConfiguration.get_instance().config)
     context = self.setup_fake_op_endpoints(FakeOP.STATE)
     openid_backend.redirect_endpoint(context)
Beispiel #4
0
 def test_redirect_endpoint_returned_correct_user_info(self):
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     openid_backend = OpenIdBackend(
         verify_userinfo_callback,
         INTERNAL_ATTRIBUTES,
         TestConfiguration.get_instance().config
     )
     context = self.setup_fake_op_endpoints(FakeOP.STATE)
     openid_backend.redirect_endpoint(context)
Beispiel #5
0
 def test_translate_response_to_internal_response(self):
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     sub = "123qweasd"
     response = {"given_name": "Bob", "family_name": "Devsson", "sub": sub}
     internal_response = self.openid_backend._translate_response(
         response,
         TestConfiguration.get_instance().rp_config.OP_URL, "public")
     assert internal_response.get_user_id() == sub
     attributes_keys = internal_response._attributes.keys()
     assert sorted(attributes_keys) == sorted(
         ['surname', 'edupersontargetedid', 'givenname'])
Beispiel #6
0
 def test_translate_response_to_internal_response(self):
     self.fake_op.setup_webfinger_endpoint()
     self.fake_op.setup_opienid_config_endpoint()
     self.fake_op.setup_client_registration_endpoint()
     sub = "123qweasd"
     response = {"given_name": "Bob", "family_name": "Devsson", "sub": sub}
     internal_response = self.openid_backend._translate_response(
         response,
         TestConfiguration.get_instance().rp_config.OP_URL,
         "public"
     )
     assert internal_response.get_user_id() == sub
     attributes_keys = internal_response._attributes.keys()
     assert sorted(attributes_keys) == sorted(['surname', 'edupersontargetedid', 'givenname'])
Beispiel #7
0
 def setup(self):
     self.openid_backend = OpenIdBackend(
         MagicMock, INTERNAL_ATTRIBUTES,
         TestConfiguration.get_instance().config)
     self.fake_op = FakeOP()
Beispiel #8
0
 def setup(self):
     self.openid_backend = OpenIdBackend(MagicMock, INTERNAL_ATTRIBUTES, TestConfiguration.get_instance().config)
     self.fake_op = FakeOP()