2 if os.path.exists('/usr/share/pam-configs/arvados') and os.getuid() == 0:
3 """These tests assume we are running (in a docker container) with
4 arvados_pam configured and a test API server running.
9 # From services/api/test/fixtures/api_client_authorizations.yml
10 # because that file is not available during integration tests:
11 ACTIVE_TOKEN = '3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi'
12 SPECTATOR_TOKEN = 'zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu'
14 class IntegrationTest(unittest.TestCase):
19 self.assertTrue(self.p.authenticate('active', ACTIVE_TOKEN, service='login'))
21 def test_deny_bad_token(self):
22 self.assertFalse(self.p.authenticate('active', 'thisisaverybadtoken', service='login'))
24 def test_deny_empty_token(self):
25 self.assertFalse(self.p.authenticate('active', '', service='login'))
27 def test_deny_permission(self):
28 self.assertFalse(self.p.authenticate('spectator', SPECTATOR_TOKEN, service='login'))