Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/browse/views/test_origin.py
Show First 20 Lines • Show All 855 Lines • ▼ Show 20 Lines | for browse_context in ( | ||||
"directory", | "directory", | ||||
"log", | "log", | ||||
"branches", | "branches", | ||||
"releases", | "releases", | ||||
"visits", | "visits", | ||||
): | ): | ||||
url = reverse(f"browse-origin-{browse_context}") | url = reverse(f"browse-origin-{browse_context}") | ||||
if browse_context == "log": | |||||
# FIXME; temporory fix for partial T3608 | |||||
# Will be removed once every origin duplicate URL is moved | |||||
resp = check_html_get_response(client, url, status_code=302) | |||||
assert "/snapshot-log/" in resp.url | |||||
else: | |||||
resp = check_html_get_response( | resp = check_html_get_response( | ||||
client, url, status_code=400, template_used="error.html" | client, url, status_code=400, template_used="error.html" | ||||
) | ) | ||||
assert_contains( | assert_contains( | ||||
resp, "An origin URL must be provided as query parameter.", status_code=400 | resp, | ||||
"An origin URL must be provided as query parameter.", | |||||
status_code=400, | |||||
) | ) | ||||
anlambert: Please move the redirection check in a separate test. | |||||
def _origin_content_view_test_helper( | def _origin_content_view_test_helper( | ||||
client, | client, | ||||
archive_data, | archive_data, | ||||
origin_info, | origin_info, | ||||
origin_visit, | origin_visit, | ||||
Done Inline ActionsThis test is not complete and can be improved, use this instead: @given(origin()) @pytest.mark.parametrize("browse_context", ["log"]) def test_origin_view_redirects(client, browse_context, origin): query_params = {"origin_url": origin["url"]} url = reverse(f"browse-origin-{browse_context}", query_params=query_params) resp = check_html_get_response(client, url, status_code=301) assert resp["location"] == reverse( f"browse-snapshot-{browse_context}", query_params=query_params ) anlambert: This test is not complete and can be improved, use this instead:
```lang=python
@given(origin… | |||||
Done Inline ActionsThis should be assert "/snapshot/{browse_context}/" in resp.url jayeshv: This should be assert "/snapshot/{browse_context}/" in resp.url
I will fix this with… | |||||
snapshot_sizes, | snapshot_sizes, | ||||
origin_branches, | origin_branches, | ||||
origin_releases, | origin_releases, | ||||
root_dir_sha1, | root_dir_sha1, | ||||
content, | content, | ||||
visit_id=None, | visit_id=None, | ||||
timestamp=None, | timestamp=None, | ||||
snapshot_id=None, | snapshot_id=None, | ||||
▲ Show 20 Lines • Show All 452 Lines • Show Last 20 Lines |
Please move the redirection check in a separate test.