diff --git a/apps/registration/tests.py b/apps/registration/tests.py index ebf70dc..dcef4a8 100644 --- a/apps/registration/tests.py +++ b/apps/registration/tests.py @@ -1,5 +1,7 @@ import os +from django.core.management import call_command + from corres2math.tokens import email_validation_token from django.contrib.auth.models import User from django.test import TestCase @@ -279,6 +281,26 @@ class TestRegistration(TestCase): self.assertRedirects(response, reverse("index"), 302, 200) self.assertFalse("_fake_user_id" in self.client.session) + def test_research(self): + """ + Try to search some things. + """ + call_command("rebuild_index", "--noinput", "-v", 0) + + response = self.client.get(reverse("haystack_search") + "?q=" + self.user.email) + self.assertEqual(response.status_code, 200) + self.assertTrue(response.context["object_list"]) + + response = self.client.get(reverse("haystack_search") + "?q=" + + str(self.coach.registration.professional_activity)) + self.assertEqual(response.status_code, 200) + self.assertTrue(response.context["object_list"]) + + response = self.client.get(reverse("haystack_search") + "?q=" + + self.student.registration.get_student_class_display()) + self.assertEqual(response.status_code, 200) + self.assertTrue(response.context["object_list"]) + def test_string_render(self): # TODO These string field tests will be removed when used in a template self.assertRaises(NotImplementedError, lambda: Registration().type) diff --git a/corres2math/templates/search/search.html b/corres2math/templates/search/search.html index e510d01..d3f41f1 100644 --- a/corres2math/templates/search/search.html +++ b/corres2math/templates/search/search.html @@ -6,7 +6,6 @@

{% trans "Search" %}

- {% csrf_token %} {{ form|crispy }}