| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # Copyright 2015 The LUCI Authors. All rights reserved. | 3 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 4 # Use of this source code is governed under the Apache License, Version 2.0 | 4 # Use of this source code is governed under the Apache License, Version 2.0 |
| 5 # that can be found in the LICENSE file. | 5 # that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import base64 | 7 import base64 |
| 8 import datetime | 8 import datetime |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 self.set_as_user() | 63 self.set_as_user() |
| 64 | 64 |
| 65 | 65 |
| 66 class ServerApiTest(BaseTest): | 66 class ServerApiTest(BaseTest): |
| 67 api_service_cls = handlers_endpoints.SwarmingServerService | 67 api_service_cls = handlers_endpoints.SwarmingServerService |
| 68 | 68 |
| 69 def test_details(self): | 69 def test_details(self): |
| 70 """Asserts that server_details returns the correct version.""" | 70 """Asserts that server_details returns the correct version.""" |
| 71 response = self.call_api('details') | 71 response = self.call_api('details') |
| 72 self.assertEqual({ | 72 self.assertEqual({ |
| 73 'machine_provider_prefix': '', |
| 74 'milo_prefix': '', |
| 75 'sk_revision_prefix': '', |
| 73 'server_version': utils.get_app_version(), | 76 'server_version': utils.get_app_version(), |
| 74 'bot_version': bot_code.get_bot_version('https://testbed.example.com'), | 77 'bot_version': bot_code.get_bot_version('https://testbed.example.com'), |
| 75 }, response.json) | 78 }, response.json) |
| 76 | 79 |
| 77 def test_public_permissions(self): | 80 def test_public_permissions(self): |
| 78 """Asserts that permissions respond correctly to an unauthed user.""" | 81 """Asserts that permissions respond correctly to an unauthed user.""" |
| 79 self.set_as_anonymous() | 82 self.set_as_anonymous() |
| 80 response = self.call_api('permissions') | 83 response = self.call_api('permissions') |
| 81 expected = { | 84 expected = { |
| 82 u'cancel_task': False, | 85 u'cancel_task': False, |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 self.assertEqual(expected, response.json) | 2010 self.assertEqual(expected, response.json) |
| 2008 | 2011 |
| 2009 | 2012 |
| 2010 if __name__ == '__main__': | 2013 if __name__ == '__main__': |
| 2011 if '-v' in sys.argv: | 2014 if '-v' in sys.argv: |
| 2012 unittest.TestCase.maxDiff = None | 2015 unittest.TestCase.maxDiff = None |
| 2013 logging.basicConfig(level=logging.DEBUG) | 2016 logging.basicConfig(level=logging.DEBUG) |
| 2014 else: | 2017 else: |
| 2015 logging.basicConfig(level=logging.CRITICAL) | 2018 logging.basicConfig(level=logging.CRITICAL) |
| 2016 unittest.main() | 2019 unittest.main() |
| OLD | NEW |