| 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 logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 expected = [ | 733 expected = [ |
| 734 { | 734 { |
| 735 'authenticated_as': u'bot:whitelisted-ip', | 735 'authenticated_as': u'bot:whitelisted-ip', |
| 736 'dimensions': { | 736 'dimensions': { |
| 737 u'id': [u'bot1'], | 737 u'id': [u'bot1'], |
| 738 u'os': [u'Amiga'], | 738 u'os': [u'Amiga'], |
| 739 u'pool': [u'default'], | 739 u'pool': [u'default'], |
| 740 }, | 740 }, |
| 741 'event_type': unicode(e), | 741 'event_type': unicode(e), |
| 742 'external_ip': u'192.168.2.2', | 742 'external_ip': u'192.168.2.2', |
| 743 'lease_id': None, |
| 744 'lease_expiration_ts': None, |
| 743 'message': u'for the best', | 745 'message': u'for the best', |
| 744 'quarantined': False, | 746 'quarantined': False, |
| 745 'state': { | 747 'state': { |
| 746 u'bot_group_cfg_version': u'default', | 748 u'bot_group_cfg_version': u'default', |
| 747 u'running_time': 1234.0, | 749 u'running_time': 1234.0, |
| 748 u'sleep_streak': 0, | 750 u'sleep_streak': 0, |
| 749 u'started_ts': 1410990411.111, | 751 u'started_ts': 1410990411.111, |
| 750 }, | 752 }, |
| 751 'task_id': u'', | 753 'task_id': u'', |
| 752 'ts': now, | 754 'ts': now, |
| 753 'version': self.bot_version, | 755 'version': self.bot_version, |
| 754 } for e in reversed(handlers_bot.BotEventHandler.ALLOWED_EVENTS) | 756 } for e in reversed(handlers_bot.BotEventHandler.ALLOWED_EVENTS) |
| 755 if e != 'bot_error' | 757 if e != 'bot_error' |
| 756 ] | 758 ] |
| 757 expected.append( | 759 expected.append( |
| 758 { | 760 { |
| 759 'authenticated_as': u'bot:whitelisted-ip', | 761 'authenticated_as': u'bot:whitelisted-ip', |
| 760 'dimensions': { | 762 'dimensions': { |
| 761 u'id': [u'bot1'], | 763 u'id': [u'bot1'], |
| 762 u'os': [u'Amiga'], | 764 u'os': [u'Amiga'], |
| 763 u'pool': [u'default'], | 765 u'pool': [u'default'], |
| 764 }, | 766 }, |
| 765 'event_type': u'bot_connected', | 767 'event_type': u'bot_connected', |
| 766 'external_ip': u'192.168.2.2', | 768 'external_ip': u'192.168.2.2', |
| 769 'lease_id': None, |
| 770 'lease_expiration_ts': None, |
| 767 'message': None, | 771 'message': None, |
| 768 'quarantined': False, | 772 'quarantined': False, |
| 769 'state': { | 773 'state': { |
| 770 u'running_time': 1234.0, | 774 u'running_time': 1234.0, |
| 771 u'sleep_streak': 0, | 775 u'sleep_streak': 0, |
| 772 u'started_ts': 1410990411.111, | 776 u'started_ts': 1410990411.111, |
| 773 }, | 777 }, |
| 774 'task_id': u'', | 778 'task_id': u'', |
| 775 'ts': now, | 779 'ts': now, |
| 776 'version': u'123', | 780 'version': u'123', |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 self.app.get('/bot_code?tok=%s' % tok, status=200) | 1042 self.app.get('/bot_code?tok=%s' % tok, status=200) |
| 1039 | 1043 |
| 1040 | 1044 |
| 1041 if __name__ == '__main__': | 1045 if __name__ == '__main__': |
| 1042 if '-v' in sys.argv: | 1046 if '-v' in sys.argv: |
| 1043 unittest.TestCase.maxDiff = None | 1047 unittest.TestCase.maxDiff = None |
| 1044 logging.basicConfig( | 1048 logging.basicConfig( |
| 1045 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, | 1049 level=logging.DEBUG if '-v' in sys.argv else logging.CRITICAL, |
| 1046 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') | 1050 format='%(levelname)-7s %(filename)s:%(lineno)3d %(message)s') |
| 1047 unittest.main() | 1051 unittest.main() |
| OLD | NEW |