Skip to content

Commit

Permalink
trying to reproduce #836
Browse files Browse the repository at this point in the history
  • Loading branch information
geier committed Oct 31, 2023
1 parent 3a4298b commit e7ebaff
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e7ebaff

Please sign in to comment.