From 72f6afb1c4a830d1bf47c33e11d3fdbbe0360cb5 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Tue, 17 Apr 2018 11:31:47 -0400 Subject: [PATCH] Add test case for searchable deletion --- events/tests/federation.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/events/tests/federation.py b/events/tests/federation.py index 4a9c50f..d2f08fa 100644 --- a/events/tests/federation.py +++ b/events/tests/federation.py @@ -1,7 +1,7 @@ from django.test import TestCase from model_mommy import mommy -from ..models.events import Event +from ..models.events import Event, delete_event_searchable from ..models.search import Searchable # Create your tests here. @@ -38,3 +38,20 @@ class SearchableCreationTest(TestCase): assert(searchables.count() == 1) assert(searchables[0].event_title == "New Title") + def test_delete_searchable_with_event(self): + searchables = Searchable.objects.all() + assert(searchables.count() == 0) + + event = mommy.make(Event) + event.save() + + searchables = Searchable.objects.all() + assert(searchables.count() == 1) + + delete_event_searchable(event) + event.delete() + + searchables = Searchable.objects.all() + assert(searchables.count() == 0) + +