Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: appengine/auth_service/config_test.py

Issue 2164733003: auth: Keep audit log of all generated delegation tokens. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: auth: Keep audit log of all generates delegation tokens. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/auth_service/config.py ('k') | appengine/auth_service/delegation.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import datetime 6 import datetime
7 import logging 7 import logging
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 config.Revision('oauth_cfg_rev', 'http://url'), 434 config.Revision('oauth_cfg_rev', 'http://url'),
435 config_pb2.OAuthConfig(primary_client_id='a')), 435 config_pb2.OAuthConfig(primary_client_id='a')),
436 }, result) 436 }, result)
437 437
438 def test_fetch_configs_not_valid(self): 438 def test_fetch_configs_not_valid(self):
439 @ndb.tasklet 439 @ndb.tasklet
440 def get_self_config_mock(*_args, **_kwargs): 440 def get_self_config_mock(*_args, **_kwargs):
441 raise ndb.Return(('imports_cfg_rev', 'bad config')) 441 raise ndb.Return(('imports_cfg_rev', 'bad config'))
442 self.mock(config_component, 'get_self_config_async', get_self_config_mock) 442 self.mock(config_component, 'get_self_config_async', get_self_config_mock)
443 self.mock(config, '_get_configs_url', lambda: 'http://url') 443 self.mock(config, '_get_configs_url', lambda: 'http://url')
444 with self.assertRaises(config_component.CannotLoadConfigError): 444 with self.assertRaises(config.CannotLoadConfigError):
445 config._fetch_configs(['imports.cfg']) 445 config._fetch_configs(['imports.cfg'])
446 446
447 def test_gitiles_url(self): 447 def test_gitiles_url(self):
448 self.assertEqual( 448 self.assertEqual(
449 'https://host/repo/+/aaa/path/b/c.cfg', 449 'https://host/repo/+/aaa/path/b/c.cfg',
450 config._gitiles_url('https://host/repo/+/HEAD/path', 'aaa', 'b/c.cfg')) 450 config._gitiles_url('https://host/repo/+/HEAD/path', 'aaa', 'b/c.cfg'))
451 self.assertEqual( 451 self.assertEqual(
452 'https://not-gitiles', 452 'https://not-gitiles',
453 config._gitiles_url('https://not-gitiles', 'aaa', 'b/c.cfg')) 453 config._gitiles_url('https://not-gitiles', 'aaa', 'b/c.cfg'))
454 454
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 self.assertEqual(1, len(proto.rules)) 603 self.assertEqual(1, len(proto.rules))
604 604
605 605
606 if __name__ == '__main__': 606 if __name__ == '__main__':
607 if '-v' in sys.argv: 607 if '-v' in sys.argv:
608 unittest.TestCase.maxDiff = None 608 unittest.TestCase.maxDiff = None
609 logging.basicConfig(level=logging.DEBUG) 609 logging.basicConfig(level=logging.DEBUG)
610 else: 610 else:
611 logging.basicConfig(level=logging.FATAL) 611 logging.basicConfig(level=logging.FATAL)
612 unittest.main() 612 unittest.main()
OLDNEW
« no previous file with comments | « appengine/auth_service/config.py ('k') | appengine/auth_service/delegation.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698