Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
[WIP] test
Browse files Browse the repository at this point in the history
  • Loading branch information
divyaparameswaran committed Feb 17, 2024
1 parent e4e558b commit eb0f5a8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions find_a_supplier/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,15 @@ def test_contact_company_exposes_context(mock_get_company_profile, client):
)


@mock.patch('django.utils.http.url_has_allowed_host_and_scheme')
def test_unsafe_url_redirect(mock_url_has_allowed_host_and_scheme, client):
mock_url_has_allowed_host_and_scheme.return_value = False
url = reverse('find-a-supplier:search')
response = client.get(url, {'term': 'http://example.com'})
assert response.status_code == 302
assert response.url == reverse('find-a-supplier:search')


@mock.patch('find_a_supplier.views.CompanySearchView.get_results_and_count')
def test_company_search_submit_form_on_get(mock_get_results_and_count, client, search_results):
results = [{'number': '1234567', 'slug': 'thing'}]
Expand Down

0 comments on commit eb0f5a8

Please sign in to comment.