From b7c16f9223ce62e47d9fb9c158a8f3422a46e8e7 Mon Sep 17 00:00:00 2001 From: Patrick Lecuyer Date: Sun, 26 Feb 2017 17:34:23 -0500 Subject: [PATCH 1/3] Fixed business hours issue for test_auto_escalate --- tests/user_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/user_test.py b/tests/user_test.py index 0f10879..1f129f6 100644 --- a/tests/user_test.py +++ b/tests/user_test.py @@ -3,6 +3,7 @@ from collections import defaultdict from datetime import timedelta +from time import sleep import securitybot.user as user import securitybot.bot @@ -279,8 +280,9 @@ def test_not_allow_2fa_flow(self, auth, mock_task): test_user._last_message.text == '') mock_task.stop() - - @patch('securitybot.user.ESCALATION_TIME', timedelta(seconds=-1)) + # Putting escalation time in the past to make sure tests outsisde of + # business hours won't fail + @patch('securitybot.user.ESCALATION_TIME', timedelta(weeks=-1)) @patch('securitybot.tasker.tasker.Task') @patch('securitybot.auth.auth.Auth', autospec=True) def test_auto_escalate(self, auth, mock_task): @@ -299,7 +301,8 @@ def test_auto_escalate(self, auth, mock_task): assert str(test_user._fsm.state) == 'action_performed_check' # Auto-escalation should happen immediately because escalation time - # is set to be zero seconds + # is set in the past + test_user.step() assert str(test_user._fsm.state) == 'task_finished' From 63cc1f9cad575f4a6f9bfc42c25d706c3fc57e32 Mon Sep 17 00:00:00 2001 From: Patrick Lecuyer Date: Sun, 26 Feb 2017 17:57:46 -0500 Subject: [PATCH 2/3] Workaround for flake8 F401 error on type hints --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18e0f53..f733e25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,5 @@ python: sudo: false install: pip install -r requirements.txt script: - - flake8 securitybot/ + - flake8 --ignore F401 securitybot/ - PYTHONPATH=$(pwd) py.test -v tests/ - From 8cc4846602011db396df621d2e84e5808a6f3441 Mon Sep 17 00:00:00 2001 From: Ishan Jain Date: Sat, 15 Apr 2017 05:30:46 +0530 Subject: [PATCH 3/3] Fix for #14 --- securitybot/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/securitybot/commands.py b/securitybot/commands.py index c1f1a94..099f052 100644 --- a/securitybot/commands.py +++ b/securitybot/commands.py @@ -66,8 +66,8 @@ def ignore(bot, user, args): # Find correct task in user object task = None - if which == 'last' and user.old_tasks: - task = user.old_tasks[-1] + if which == 'last' and user.tasks: + task = user.tasks[-1] elif which == 'current' and user.pending_task: task = user.pending_task if task is None: