Add test case for searchable deletion
This commit is contained in:
parent
d42272ce63
commit
72f6afb1c4
1 changed files with 18 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue