diff options
author | Joel Ostblom <joel.ostblom@gmail.com> | 2021-06-05 20:16:44 -0700 |
---|---|---|
committer | Julien Maupetit <jmaupetit@users.noreply.github.com> | 2021-06-09 17:55:32 +0200 |
commit | 275bd05fddc13b8a69a10ea6f41f2e4ae4e04f47 (patch) | |
tree | 4a12a259b816ce7e77520926bb05ae9f42dc1a0e | |
parent | ca6b6139ea046519c06258d6d107fdc666ed0f83 (diff) |
Add test for restart command
This doesn't necessarily test the gap options added in this PR,
just the same basic functinality as is tested for the start command.
-rw-r--r-- | tests/test_cli.py | 18 |
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 |