Esempio n. 1
0
    def test_auth_allowed_in_whitelisted_domains_conf(self):
        factories.Organization(name=settings.DEFAULT_ORG)

        backend = self.BackendTest()
        backend.WHITELISTED_DOMAINS = ['testenv.com']
        details = {'email': '*****@*****.**'}
        result = auth_pipeline.auth_allowed(backend, details, None)
        self.assertIsNone(result)
        self.assertIn('organization_uuid', details)
Esempio n. 2
0
 def test_auth_allowed_no_whitelist_oauth_domain(self):
     backend = self.BackendTest()
     details = {'email': self.core_user.email}
     response = auth_pipeline.auth_allowed(backend, details, None)
     template_content = response.content
     self.assertIn(
         b"You don't appear to have permissions to access "
         b"the system.", template_content)
     self.assertIn(b"Please check with your organization to have access.",
                   template_content)
Esempio n. 3
0
 def test_auth_allowed_no_email(self):
     factories.Organization(name=settings.DEFAULT_ORG)
     backend = self.BackendTest()
     details = {}
     response = auth_pipeline.auth_allowed(backend, details, None)
     template_content = response.content
     self.assertIn(
         b"You don't appear to have permissions to access "
         b"the system.", template_content)
     self.assertIn(b"Please check with your organization to have access.",
                   template_content)
Esempio n. 4
0
    def test_auth_allowed_multi_oauth_domain(self):
        self.org.oauth_domains = ['testenv.com']
        self.org.save()
        factories.Organization(name='Another Org',
                               oauth_domains=['testenv.com'])

        backend = self.BackendTest()
        details = {'email': self.core_user.email}
        response = auth_pipeline.auth_allowed(backend, details, None)
        template_content = response.content
        self.assertIn(
            b"You don't appear to have permissions to access "
            b"the system.", template_content)
        self.assertIn(b"Please check with your organization to have access.",
                      template_content)
Esempio n. 5
0
 def test_pipeline_fails(self):
     response = auth_allowed(None, {"email": "*****@*****.**"}, None)
     self.assertEqual(response.status_code, 403)
Esempio n. 6
0
 def test_pipeline_ok(self):
     self.assertEqual(auth_allowed(None, {"email": "*****@*****.**"}, None),
                      None)