summaryrefslogtreecommitdiffstats
path: root/tests/test_cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_cli.py')
-rw-r--r--tests/test_cli.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 2a1b3a5..5c28317 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -196,6 +196,32 @@ def test_start_valid_time(runner, watson, mocker, at_dt):
assert result.exit_code == 0
+# watson start new task in past, with existing task
+
+def test_start_existing_frame_stopped(runner, watson, mocker):
+ # Simulate a start date so that 'at_dt' is older than now().
+ watson.config.set('options', 'stop_on_start', "true")
+ mocker.patch('arrow.arrow.dt_datetime', wraps=datetime)
+ start_dt = datetime(2019, 4, 10, 15, 0, 0, tzinfo=local_tz_info())
+ arrow.arrow.dt_datetime.now.return_value = start_dt
+ runner.invoke(
+ cli.start,
+ ['a-project', '--at', "14:10"],
+ obj=watson,
+ )
+
+ result = runner.invoke(
+ cli.start,
+ ['b-project', '--at', "14:15"],
+ obj=watson,
+ )
+ assert result.exit_code == 0, result.stdout
+
+ frame_id = OutputParser.get_frame_id(result.output)
+ assert watson.frames[frame_id].project == "a-project"
+ assert watson.current["project"] == "b-project"
+
+
# watson restart
@pytest.mark.parametrize('at_dt', VALID_TIMES_DATA)