mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-11 17:41:18 +00:00
Test registration search
This commit is contained in:
parent
62b883467c
commit
c80355f2bc
@ -1,5 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
from django.core.management import call_command
|
||||||
|
|
||||||
from corres2math.tokens import email_validation_token
|
from corres2math.tokens import email_validation_token
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
@ -279,6 +281,26 @@ class TestRegistration(TestCase):
|
|||||||
self.assertRedirects(response, reverse("index"), 302, 200)
|
self.assertRedirects(response, reverse("index"), 302, 200)
|
||||||
self.assertFalse("_fake_user_id" in self.client.session)
|
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):
|
def test_string_render(self):
|
||||||
# TODO These string field tests will be removed when used in a template
|
# TODO These string field tests will be removed when used in a template
|
||||||
self.assertRaises(NotImplementedError, lambda: Registration().type)
|
self.assertRaises(NotImplementedError, lambda: Registration().type)
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
<h2>{% trans "Search" %}</h2>
|
<h2>{% trans "Search" %}</h2>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
{% csrf_token %}
|
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<button type="submit" class="btn btn-primary">{% trans "Search" %}</button>
|
<button type="submit" class="btn btn-primary">{% trans "Search" %}</button>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user