3 from .models import Author, Work, Quote
6 @pytest.fixture(scope='function')
8 a1 = Author.objects.create(name="JFK")
9 w1 = Work.objects.create(name="Berlin speech", author=a1)
10 q1 = Quote.objects.create(text="<p>Ich bin...</p>", work=w1)
13 @pytest.mark.django_db
14 def test_search(self, q1, c):
15 results = c.postPage('search/', {'q': 'Ich'})
17 assert 'JFK' in results
19 @pytest.mark.django_db
20 def test_emptysearch(self, q1, c):
21 assert c.postPage('search/', {'q': 'something that matches nothing'})