Skip to content

Commit

Permalink
Remove old migration test
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Nov 5, 2024
1 parent 6ed9001 commit f93037e
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions temba/notifications/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from temba.flows.models import ResultsExport
from temba.msgs.models import MessageExport
from temba.orgs.models import Invitation, ItemCount, OrgRole
from temba.tests import CRUDLTestMixin, MigrationTest, TembaTest, matchers
from temba.tests import CRUDLTestMixin, TembaTest, matchers
from temba.tickets.models import TicketExport

from .incidents.builtin import ChannelTemplatesFailedIncidentType, OrgFlaggedIncidentType
Expand Down Expand Up @@ -597,34 +597,3 @@ def test_trim_task(self):

self.assertFalse(Notification.objects.filter(id=notification1.id).exists())
self.assertTrue(Notification.objects.filter(id=notification2.id).exists())


class BackfillNewCountsTest(MigrationTest):
app = "notifications"
migrate_from = "0025_update_triggers"
migrate_to = "0026_backfill_new_counts"

def setUpBeforeMigration(self, apps):
imp = ContactImport.objects.create(
org=self.org, mappings={}, num_records=5, created_by=self.editor, modified_by=self.editor
)
Notification.create_all(
imp.org, "import:finished", scope=f"contact:{imp.id}", users=[self.editor], contact_import=imp, medium="UE"
)
Notification.create_all(self.org, "tickets:opened", scope="", users=[self.agent, self.editor], medium="UE")
Notification.create_all(self.org, "tickets:activity", scope="", users=[self.agent, self.editor], medium="UE")
Notification.create_all(self.org, "tickets:reply", scope="12", users=[self.editor], medium="E") # email only
Notification.create_all(
self.org2, "tickets:activity", scope="", users=[self.editor], medium="UE"
) # different org

self.org2.counts.all().delete()

def test_migration(self):
def assert_count(org, user, expected: int):
self.assertEqual(expected, Notification.get_unseen_count(org, user))

assert_count(self.org, self.agent, 2)
assert_count(self.org, self.editor, 3)
assert_count(self.org2, self.agent, 0)
assert_count(self.org2, self.editor, 1)

0 comments on commit f93037e

Please sign in to comment.