40 lines
1 KiB
Python
40 lines
1 KiB
Python
from django.test import TestCase
|
|
from model_mommy import mommy
|
|
|
|
from ..models.events import Event
|
|
from ..models.search import Searchable
|
|
|
|
# Create your tests here.
|
|
class SearchableCreationTest(TestCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
|
|
def tearDown(self):
|
|
super().tearDown()
|
|
|
|
def test_searchable_creation(self):
|
|
searchables = Searchable.objects.all()
|
|
assert(searchables.count() == 0)
|
|
|
|
event = mommy.make(Event)
|
|
event.save()
|
|
|
|
searchables = Searchable.objects.all()
|
|
assert(searchables.count() == 1)
|
|
|
|
def test_searchable_update(self):
|
|
event = mommy.make(Event, name="Old Title")
|
|
event.save()
|
|
|
|
searchables = Searchable.objects.all()
|
|
assert(searchables.count() == 1)
|
|
assert(searchables[0].event_title == "Old Title")
|
|
|
|
event.name = "New Title"
|
|
event.save()
|
|
|
|
searchables = Searchable.objects.all()
|
|
assert(searchables.count() == 1)
|
|
assert(searchables[0].event_title == "New Title")
|
|
|