Add test case for searchable deletion

This commit is contained in:
Michael Hall 2018-04-17 11:31:47 -04:00
parent d42272ce63
commit 72f6afb1c4

View file

@ -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)