diff options
author | Daniel Schadt <kingdread@gmx.de> | 2024-11-25 21:23:15 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2024-11-25 21:23:15 +0100 |
commit | e82233c57ba2a76dd2fbe10cec8effceac2a3e75 (patch) | |
tree | b96cc2a5b55fe339cace83dd90acb4e9bfae87c8 /tests/unit/views | |
parent | b637a46e99bd5bce8035f66bb14b32f8ec1a60b6 (diff) | |
download | fietsboek-e82233c57ba2a76dd2fbe10cec8effceac2a3e75.tar.gz fietsboek-e82233c57ba2a76dd2fbe10cec8effceac2a3e75.tar.bz2 fietsboek-e82233c57ba2a76dd2fbe10cec8effceac2a3e75.zip |
add tests for prev_next_month
Diffstat (limited to 'tests/unit/views')
-rw-r--r-- | tests/unit/views/test_profile.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/views/test_profile.py b/tests/unit/views/test_profile.py new file mode 100644 index 0000000..bc8e794 --- /dev/null +++ b/tests/unit/views/test_profile.py @@ -0,0 +1,21 @@ +import pytest +import datetime + +from fietsboek.views import profile + + +@pytest.mark.parametrize("current, prev_month, next_month", [ + ((2024, 2, 1), (2024, 1, 1), (2024, 3, 1)), + ((2024, 1, 1), (2023, 12, 1), (2024, 2, 1)), + ((2024, 12, 1), (2024, 11, 1), (2025, 1, 1)), + ((2024, 5, 5), (2024, 4, 1), (2024, 6, 1)), + ((2024, 7, 31), (2024, 6, 1), (2024, 8, 1)), +]) +def test_prev_next_month(current, prev_month, next_month): + current = datetime.date(*current) + prev_month = datetime.date(*prev_month) + next_month = datetime.date(*next_month) + + actual_prev, actual_next = profile.prev_next_month(current) + assert actual_prev == prev_month + assert actual_next == next_month |