From e82233c57ba2a76dd2fbe10cec8effceac2a3e75 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 25 Nov 2024 21:23:15 +0100 Subject: add tests for prev_next_month --- tests/unit/views/test_profile.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/unit/views/test_profile.py (limited to 'tests/unit/views') 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 -- cgit v1.2.3