Ejemplo n.º 1
0
class ProjectAPIAuthTestCase(OrchestraTestCase):

    def setUp(self):
        super().setUp()
        setup_models(self)
        self.authentication = OrchestraProjectAPIAuthentication()

    def test_auth_success(self):
        self.assertEquals(
            self.authentication.fetch_user_data('a'),
            (SignedUser(), 'b'))

    def test_no_key(self):
        with self.assertRaises(AuthenticationFailed):
            self.authentication.fetch_user_data('c')

    def test_misconfigured_credentials(self):
        tmp_setting = settings.ORCHESTRA_PROJECT_API_CREDENTIALS
        del settings.ORCHESTRA_PROJECT_API_CREDENTIALS
        with self.assertRaises(AuthenticationFailed):
            self.authentication.fetch_user_data('a')
        settings.ORCHESTRA_PROJECT_API_CREDENTIALS = tmp_setting
        self.assertEquals(
            self.authentication.fetch_user_data('a'),
            (SignedUser(), 'b'))
Ejemplo n.º 2
0
class ProjectAPIAuthTestCase(OrchestraTestCase):

    def setUp(self):
        super().setUp()
        setup_models(self)
        self.authentication = OrchestraProjectAPIAuthentication()

    def test_auth_success(self):
        self.assertEqual(
            self.authentication.fetch_user_data('a'),
            (SignedUser(), 'b'))

    def test_no_key(self):
        with self.assertRaises(AuthenticationFailed):
            self.authentication.fetch_user_data('c')

    def test_misconfigured_credentials(self):
        tmp_setting = settings.ORCHESTRA_PROJECT_API_CREDENTIALS
        del settings.ORCHESTRA_PROJECT_API_CREDENTIALS
        with self.assertRaises(AuthenticationFailed):
            self.authentication.fetch_user_data('a')
        settings.ORCHESTRA_PROJECT_API_CREDENTIALS = tmp_setting
        self.assertEqual(
            self.authentication.fetch_user_data('a'),
            (SignedUser(), 'b'))
Ejemplo n.º 3
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Ejemplo n.º 4
0
 def setUp(self):
     super().setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Ejemplo n.º 5
0
 def setUp(self):  # noqa
     super(ProjectAPIAuthTestCase, self).setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()
Ejemplo n.º 6
0
 def setUp(self):  # noqa
     super(ProjectAPIAuthTestCase, self).setUp()
     setup_models(self)
     self.authentication = OrchestraProjectAPIAuthentication()