Skip to content

Commit

Permalink
Fix tests depending on year 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
tvedeane committed Jan 7, 2024
1 parent 9aac610 commit ee3c028
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 2 additions & 8 deletions tapir/coop/tests/test_MemberStatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
)
from tapir.coop.tests.factories import ShareOwnerFactory, MembershipPauseFactory
from tapir.utils.tests_utils import TapirFactoryTestBase
from tapir.utils.tests_utils import mock_timezone_now


class ShareOwnerStatusBaseTestClass(ABC):
Expand All @@ -36,17 +35,15 @@ def test_hasPastShares_returnsSold(self):
share.start_date = datetime.date(year=2020, month=1, day=1)
share.end_date = datetime.date(year=2022, month=1, day=1)
share.save()
mock_timezone_now(self, datetime.datetime(year=2023, month=1, day=1))
self.assertMemberStatus(share_owner, MemberStatus.SOLD)

def test_hasFutureShares_returnsSold(self):
share_owner: ShareOwner = ShareOwnerFactory.create(
nb_shares=1, is_investing=False
)
share: ShareOwnership = share_owner.share_ownerships.first()
share.start_date = datetime.date(year=2024, month=1, day=1)
share.start_date = datetime.date(year=3024, month=1, day=1)
share.save()
mock_timezone_now(self, datetime.datetime(year=2023, month=1, day=1))
self.assertMemberStatus(share_owner, MemberStatus.SOLD)

def test_hasNoSharesAndIsInvesting_returnsSold(self):
Expand All @@ -70,7 +67,6 @@ def test_isInvestingAndPaused_returnsInvesting(self):
start_date=datetime.date(year=2022, month=1, day=1),
end_date=datetime.date(year=2024, month=1, day=1),
)
mock_timezone_now(self, datetime.datetime(year=2023, month=1, day=1))
self.assertMemberStatus(share_owner, MemberStatus.INVESTING)

def test_isPaused_returnsPaused(self):
Expand All @@ -80,9 +76,8 @@ def test_isPaused_returnsPaused(self):
MembershipPauseFactory.create(
share_owner=share_owner,
start_date=datetime.date(year=2022, month=1, day=1),
end_date=datetime.date(year=2024, month=1, day=1),
end_date=datetime.date(year=2124, month=1, day=1),
)
mock_timezone_now(self, datetime.datetime(year=2023, month=1, day=1))
self.assertMemberStatus(share_owner, MemberStatus.PAUSED)

def test_hasInvactivePause_returnsActive(self):
Expand All @@ -94,7 +89,6 @@ def test_hasInvactivePause_returnsActive(self):
start_date=datetime.date(year=2020, month=1, day=1),
end_date=datetime.date(year=2022, month=1, day=1),
)
mock_timezone_now(self, datetime.datetime(year=2023, month=1, day=1))
self.assertMemberStatus(share_owner, MemberStatus.ACTIVE)

def test_default_returnsActive(self):
Expand Down
6 changes: 2 additions & 4 deletions tapir/welcomedesk/tests/test_welcome_desk_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from tapir.coop.tests.factories import ShareOwnerFactory, MembershipPauseFactory
from tapir.shifts.models import (
ShiftAttendanceMode,
ShiftAccountEntry,
ShiftAttendanceTemplate,
ShiftExemption,
)
from tapir.utils.tests_utils import TapirFactoryTestBase, mock_timezone_now
from tapir.utils.tests_utils import TapirFactoryTestBase
from tapir.utils.user_utils import UserUtils


Expand Down Expand Up @@ -58,9 +57,8 @@ def test_is_paused(self):
MembershipPauseFactory.create(
share_owner=user.share_owner,
start_date=datetime.date(year=2022, month=1, day=1),
end_date=datetime.date(year=2024, month=1, day=1),
end_date=datetime.date(year=3024, month=1, day=1),
)
mock_timezone_now(self, datetime.datetime(year=2024, month=1, day=1))
self.check_alerts(user.share_owner, [self.Messages.IS_PAUSED])

def test_no_abcd_shift(self):
Expand Down

0 comments on commit ee3c028

Please sign in to comment.