summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/test_cli.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
index bdd4829..2a1b3a5 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -194,3 +194,21 @@ def test_start_valid_time(runner, watson, mocker, at_dt):
arrow.arrow.dt_datetime.now.return_value = (start_dt + timedelta(hours=1))
result = runner.invoke(cli.start, ['a-project', '--at', at_dt], obj=watson)
assert result.exit_code == 0
+
+
+# watson restart
+
+@pytest.mark.parametrize('at_dt', VALID_TIMES_DATA)
+def test_restart_valid_time(runner, watson, mocker, at_dt):
+ # Create a previous entry the same as in `test_stop_valid_time`
+ mocker.patch('arrow.arrow.dt_datetime', wraps=datetime)
+ start_dt = datetime(2019, 4, 10, 14, 0, 0, tzinfo=local_tz_info())
+ arrow.arrow.dt_datetime.now.return_value = start_dt
+ result = runner.invoke(cli.start, ['a-project'], obj=watson)
+ # Simulate one hour has elapsed, so that 'at_dt' is older than now()
+ # but newer than the start date.
+ arrow.arrow.dt_datetime.now.return_value = (start_dt + timedelta(hours=1))
+ result = runner.invoke(cli.stop, ['--at', at_dt], obj=watson)
+ # Test that the last frame can be restarted
+ result = runner.invoke(cli.restart, ['--at', at_dt], obj=watson)
+ assert result.exit_code == 0