From 80e02c88b9b8811ee7d403acd0cdd1bc17a92084 Mon Sep 17 00:00:00 2001 From: Mudiwa Matanda Date: Wed, 31 Jul 2024 14:47:32 +0200 Subject: [PATCH] fixed test_delete_messages --- .../commands/tests/test_delete_historical_records.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eventstore/management/commands/tests/test_delete_historical_records.py b/eventstore/management/commands/tests/test_delete_historical_records.py index ba6d1fd4..d069f4fd 100644 --- a/eventstore/management/commands/tests/test_delete_historical_records.py +++ b/eventstore/management/commands/tests/test_delete_historical_records.py @@ -33,22 +33,23 @@ def test_invalid_arguments(self): self.assertRaises(Exception, self.call_command, "InvalidModel") def test_delete_events(self): - running_month = timezone.now() - relativedelta(months=12, hour=12) + running_month = timezone.now() - relativedelta(days=365, hour=12) for i in range(12): self.create_record(Event, i, running_month) - running_month = running_month + relativedelta(months=1) + running_month = running_month + relativedelta(days=31) self.call_command("Event", 6) self.assertEqual(Event.objects.count(), 6) def test_delete_messages(self): - running_month = timezone.now() - relativedelta(months=12, hour=12) - + running_month = timezone.now() - relativedelta(days=365, hour=12) + for i in range(12): self.create_record(Message, i, running_month) - running_month = running_month + relativedelta(months=1) + running_month = running_month + relativedelta(days=31) + print(f" running month: {running_month}") self.call_command("Message", 6)