diff --git a/tests/cli_test.py b/tests/cli_test.py index 5f90dbaaf..5e5b766c4 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -1018,3 +1018,56 @@ def test_list_now(runner, tmpdir): result = runner.invoke(main_khal, ['list', 'now']) assert not result.exception + + +@freeze_time('2019-01-21 06:30:00', tz_offset=0) +def test_reproduce_836(runner, tmpdir): + import datetime as dt + print(dt.datetime.now()) + runner = runner() + + + xdg_config_home = tmpdir.join('.config') + config_file = xdg_config_home.join('khal').join('config') + config_file.write(""" + [calendars] + [[one]] + path = {} + color = dark blue + [[two]] + path = {} + color = dark green + [[three]] + path = {} + [locale] + longdateformat = %a %Y-%m-%d + dateformat = %Y-%m-%d + default_timezone = America/Los_Angeles + local_timezone = America/Los_Angeles + """.format( + tmpdir.join('calendar'), + tmpdir.join('calendar2'), + tmpdir.join('calendar3'), + )) + + print(runner.invoke(main_khal, 'printformats --now'.split()).output) + + result = runner.invoke(main_khal, 'new -a one 2019-01-21 23:00 24:00 Meeting'.split()) + print(result.output) + result = runner.invoke(main_khal, 'new -a one 2019-01-22 17:00 20:00 Meeting'.split()) + print(result.output) + + print('$ khal calendar') + result = runner.invoke(main_khal, ['calendar']) + print(result.output) + + print('$ khal calendar 2019-01-21') + result = runner.invoke(main_khal, ['calendar', '2019-01-21']) + print(result.output) + + print('$ khal calendar 2019-01-22') + result = runner.invoke(main_khal, ['calendar', '2019-01-22']) + print(result.output) + + assert result.output == '1' + assert not result.exception