Skip to content

Commit b7d4bc3

Browse files
author
Emmanouil Konstantinidis
committed
Test search funcitonality
1 parent c548ba8 commit b7d4bc3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ def test_index_view_with_endpoints(self):
4040
# The view "OrganisationErroredView" (organisations/(?P<slug>[\w-]+)/errored/) should contain an error.
4141
self.assertEqual(str(response.context["endpoints"][8].errors), "'test_value'")
4242

43+
def test_index_search_with_endpoints(self):
44+
url = "%s?search=reset-password" % reverse("drfdocs")
45+
print(url)
46+
response = self.client.get(url)
47+
48+
self.assertEqual(response.status_code, 200)
49+
self.assertEqual(len(response.context["endpoints"]), 2)
50+
self.assertEqual(response.context["endpoints"][1].path, "/accounts/reset-password/confirm/")
51+
self.assertEqual(len(response.context["endpoints"][1].fields), 3)
52+
4353
@override_settings(REST_FRAMEWORK_DOCS=SETTINGS_HIDE_DOCS)
4454
def test_index_view_docs_hidden(self):
4555
"""

0 commit comments

Comments
 (0)