diff --git a/MANIFEST.in b/MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -7,9 +7,9 @@
recursive-include assets *
recursive-include swh/web/*/templates *
-recursive-include swh/web/*/assets *
-recursive-include swh/web/tests/resources *
-recursive-include swh/web/tests/inbound_email/resources *.eml
+recursive-include swh/web/*/tests/assets *
+recursive-include swh/web/*/tests/data *
+recursive-include swh/web/*/tests/resources *
include package.json
include yarn.lock
diff --git a/Makefile.local b/Makefile.local
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,4 +1,4 @@
-TEST_DIRS := ./swh/web/tests
+TEST_DIRS := ./swh/web/
TESTFLAGS = --hypothesis-profile=swh-web-fast
TESTFULL_FLAGS = --hypothesis-profile=swh-web
YARN ?= yarn
diff --git a/swh/web/tests/add_forge_now/__init__.py b/swh/web/add_forge_now/tests/__init__.py
rename from swh/web/tests/add_forge_now/__init__.py
rename to swh/web/add_forge_now/tests/__init__.py
diff --git a/swh/web/tests/add_forge_now/test_api_views.py b/swh/web/add_forge_now/tests/test_api_views.py
rename from swh/web/tests/add_forge_now/test_api_views.py
rename to swh/web/add_forge_now/tests/test_api_views.py
diff --git a/swh/web/tests/add_forge_now/test_app.py b/swh/web/add_forge_now/tests/test_app.py
rename from swh/web/tests/add_forge_now/test_app.py
rename to swh/web/add_forge_now/tests/test_app.py
diff --git a/swh/web/tests/add_forge_now/test_migration.py b/swh/web/add_forge_now/tests/test_migration.py
rename from swh/web/tests/add_forge_now/test_migration.py
rename to swh/web/add_forge_now/tests/test_migration.py
diff --git a/swh/web/tests/add_forge_now/test_models.py b/swh/web/add_forge_now/tests/test_models.py
rename from swh/web/tests/add_forge_now/test_models.py
rename to swh/web/add_forge_now/tests/test_models.py
diff --git a/swh/web/tests/add_forge_now/test_views.py b/swh/web/add_forge_now/tests/test_views.py
rename from swh/web/tests/add_forge_now/test_views.py
rename to swh/web/add_forge_now/tests/test_views.py
diff --git a/swh/web/tests/api/__init__.py b/swh/web/api/tests/__init__.py
rename from swh/web/tests/api/__init__.py
rename to swh/web/api/tests/__init__.py
diff --git a/swh/web/tests/api/test_api_lookup.py b/swh/web/api/tests/test_api_lookup.py
rename from swh/web/tests/api/test_api_lookup.py
rename to swh/web/api/tests/test_api_lookup.py
diff --git a/swh/web/tests/api/test_apidoc.py b/swh/web/api/tests/test_apidoc.py
rename from swh/web/tests/api/test_apidoc.py
rename to swh/web/api/tests/test_apidoc.py
diff --git a/swh/web/tests/api/test_apiresponse.py b/swh/web/api/tests/test_apiresponse.py
rename from swh/web/tests/api/test_apiresponse.py
rename to swh/web/api/tests/test_apiresponse.py
diff --git a/swh/web/tests/api/test_apiurls.py b/swh/web/api/tests/test_apiurls.py
rename from swh/web/tests/api/test_apiurls.py
rename to swh/web/api/tests/test_apiurls.py
diff --git a/swh/web/tests/api/test_throttling.py b/swh/web/api/tests/test_throttling.py
rename from swh/web/tests/api/test_throttling.py
rename to swh/web/api/tests/test_throttling.py
diff --git a/swh/web/tests/api/test_utils.py b/swh/web/api/tests/test_utils.py
rename from swh/web/tests/api/test_utils.py
rename to swh/web/api/tests/test_utils.py
diff --git a/swh/web/tests/api/views/__init__.py b/swh/web/api/tests/views/__init__.py
rename from swh/web/tests/api/views/__init__.py
rename to swh/web/api/tests/views/__init__.py
diff --git a/swh/web/tests/api/views/test_content.py b/swh/web/api/tests/views/test_content.py
rename from swh/web/tests/api/views/test_content.py
rename to swh/web/api/tests/views/test_content.py
--- a/swh/web/tests/api/views/test_content.py
+++ b/swh/web/api/tests/views/test_content.py
@@ -5,12 +5,12 @@
import pytest
-from swh.web.tests.conftest import fossology_missing
from swh.web.tests.data import random_content
from swh.web.tests.helpers import (
check_api_get_responses,
check_api_post_responses,
check_http_get_response,
+ fossology_missing,
)
from swh.web.utils import reverse
diff --git a/swh/web/tests/api/views/test_directory.py b/swh/web/api/tests/views/test_directory.py
rename from swh/web/tests/api/views/test_directory.py
rename to swh/web/api/tests/views/test_directory.py
diff --git a/swh/web/tests/api/views/test_graph.py b/swh/web/api/tests/views/test_graph.py
rename from swh/web/tests/api/views/test_graph.py
rename to swh/web/api/tests/views/test_graph.py
diff --git a/swh/web/tests/api/views/test_identifiers.py b/swh/web/api/tests/views/test_identifiers.py
rename from swh/web/tests/api/views/test_identifiers.py
rename to swh/web/api/tests/views/test_identifiers.py
diff --git a/swh/web/tests/api/views/test_metadata.py b/swh/web/api/tests/views/test_metadata.py
rename from swh/web/tests/api/views/test_metadata.py
rename to swh/web/api/tests/views/test_metadata.py
--- a/swh/web/tests/api/views/test_metadata.py
+++ b/swh/web/api/tests/views/test_metadata.py
@@ -10,7 +10,7 @@
from swh.model.hypothesis_strategies import raw_extrinsic_metadata
from swh.model.model import Origin
-from swh.web.tests.api.views.utils import scroll_results
+from swh.web.api.tests.views.utils import scroll_results
from swh.web.tests.helpers import check_api_get_responses, check_http_get_response
from swh.web.utils import reverse
diff --git a/swh/web/tests/api/views/test_origin.py b/swh/web/api/tests/views/test_origin.py
rename from swh/web/tests/api/views/test_origin.py
rename to swh/web/api/tests/views/test_origin.py
--- a/swh/web/tests/api/views/test_origin.py
+++ b/swh/web/api/tests/views/test_origin.py
@@ -16,8 +16,8 @@
from swh.search.interface import PagedResult
from swh.storage.exc import StorageAPIError, StorageDBError
from swh.storage.utils import now
+from swh.web.api.tests.views.utils import scroll_results
from swh.web.api.utils import enrich_origin, enrich_origin_visit
-from swh.web.tests.api.views.utils import scroll_results
from swh.web.tests.data import (
INDEXER_TOOL,
ORIGIN_MASTER_DIRECTORY,
diff --git a/swh/web/tests/api/views/test_ping.py b/swh/web/api/tests/views/test_ping.py
rename from swh/web/tests/api/views/test_ping.py
rename to swh/web/api/tests/views/test_ping.py
diff --git a/swh/web/tests/api/views/test_raw.py b/swh/web/api/tests/views/test_raw.py
rename from swh/web/tests/api/views/test_raw.py
rename to swh/web/api/tests/views/test_raw.py
diff --git a/swh/web/tests/api/views/test_release.py b/swh/web/api/tests/views/test_release.py
rename from swh/web/tests/api/views/test_release.py
rename to swh/web/api/tests/views/test_release.py
diff --git a/swh/web/tests/api/views/test_revision.py b/swh/web/api/tests/views/test_revision.py
rename from swh/web/tests/api/views/test_revision.py
rename to swh/web/api/tests/views/test_revision.py
diff --git a/swh/web/tests/api/views/test_snapshot.py b/swh/web/api/tests/views/test_snapshot.py
rename from swh/web/tests/api/views/test_snapshot.py
rename to swh/web/api/tests/views/test_snapshot.py
diff --git a/swh/web/tests/api/views/test_stat.py b/swh/web/api/tests/views/test_stat.py
rename from swh/web/tests/api/views/test_stat.py
rename to swh/web/api/tests/views/test_stat.py
diff --git a/swh/web/tests/api/views/utils.py b/swh/web/api/tests/views/utils.py
rename from swh/web/tests/api/views/utils.py
rename to swh/web/api/tests/views/utils.py
diff --git a/swh/web/tests/archive_coverage/__init__.py b/swh/web/archive_coverage/tests/__init__.py
rename from swh/web/tests/archive_coverage/__init__.py
rename to swh/web/archive_coverage/tests/__init__.py
diff --git a/swh/web/tests/archive_coverage/test_app.py b/swh/web/archive_coverage/tests/test_app.py
rename from swh/web/tests/archive_coverage/test_app.py
rename to swh/web/archive_coverage/tests/test_app.py
diff --git a/swh/web/tests/archive_coverage/test_coverage.py b/swh/web/archive_coverage/tests/test_coverage.py
rename from swh/web/tests/archive_coverage/test_coverage.py
rename to swh/web/archive_coverage/tests/test_coverage.py
diff --git a/swh/web/tests/auth/__init__.py b/swh/web/auth/tests/__init__.py
rename from swh/web/tests/auth/__init__.py
rename to swh/web/auth/tests/__init__.py
diff --git a/swh/web/tests/auth/test_migrations.py b/swh/web/auth/tests/test_migrations.py
rename from swh/web/tests/auth/test_migrations.py
rename to swh/web/auth/tests/test_migrations.py
diff --git a/swh/web/tests/auth/test_utils.py b/swh/web/auth/tests/test_utils.py
rename from swh/web/tests/auth/test_utils.py
rename to swh/web/auth/tests/test_utils.py
diff --git a/swh/web/tests/auth/test_views.py b/swh/web/auth/tests/test_views.py
rename from swh/web/tests/auth/test_views.py
rename to swh/web/auth/tests/test_views.py
diff --git a/swh/web/tests/badges/__init__.py b/swh/web/badges/tests/__init__.py
rename from swh/web/tests/badges/__init__.py
rename to swh/web/badges/tests/__init__.py
diff --git a/swh/web/tests/badges/test_app.py b/swh/web/badges/tests/test_app.py
rename from swh/web/tests/badges/test_app.py
rename to swh/web/badges/tests/test_app.py
diff --git a/swh/web/tests/badges/test_badges.py b/swh/web/badges/tests/test_badges.py
rename from swh/web/tests/badges/test_badges.py
rename to swh/web/badges/tests/test_badges.py
diff --git a/swh/web/tests/banners/__init__.py b/swh/web/banners/tests/__init__.py
rename from swh/web/tests/banners/__init__.py
rename to swh/web/banners/tests/__init__.py
diff --git a/swh/web/tests/banners/test_app.py b/swh/web/banners/tests/test_app.py
rename from swh/web/tests/banners/test_app.py
rename to swh/web/banners/tests/test_app.py
diff --git a/swh/web/tests/banners/test_fundraising.py b/swh/web/banners/tests/test_fundraising.py
rename from swh/web/tests/banners/test_fundraising.py
rename to swh/web/banners/tests/test_fundraising.py
diff --git a/swh/web/tests/browse/__init__.py b/swh/web/browse/tests/__init__.py
rename from swh/web/tests/browse/__init__.py
rename to swh/web/browse/tests/__init__.py
diff --git a/swh/web/tests/browse/test_snapshot_context.py b/swh/web/browse/tests/test_snapshot_context.py
rename from swh/web/tests/browse/test_snapshot_context.py
rename to swh/web/browse/tests/test_snapshot_context.py
diff --git a/swh/web/tests/browse/test_utils.py b/swh/web/browse/tests/test_utils.py
rename from swh/web/tests/browse/test_utils.py
rename to swh/web/browse/tests/test_utils.py
diff --git a/swh/web/tests/browse/views/__init__.py b/swh/web/browse/tests/views/__init__.py
rename from swh/web/tests/browse/views/__init__.py
rename to swh/web/browse/tests/views/__init__.py
diff --git a/swh/web/tests/browse/views/test_content.py b/swh/web/browse/tests/views/test_content.py
rename from swh/web/tests/browse/views/test_content.py
rename to swh/web/browse/tests/views/test_content.py
diff --git a/swh/web/tests/browse/views/test_directory.py b/swh/web/browse/tests/views/test_directory.py
rename from swh/web/tests/browse/views/test_directory.py
rename to swh/web/browse/tests/views/test_directory.py
diff --git a/swh/web/tests/browse/views/test_identifiers.py b/swh/web/browse/tests/views/test_identifiers.py
rename from swh/web/tests/browse/views/test_identifiers.py
rename to swh/web/browse/tests/views/test_identifiers.py
diff --git a/swh/web/tests/browse/views/test_iframe.py b/swh/web/browse/tests/views/test_iframe.py
rename from swh/web/tests/browse/views/test_iframe.py
rename to swh/web/browse/tests/views/test_iframe.py
diff --git a/swh/web/tests/browse/views/test_origin.py b/swh/web/browse/tests/views/test_origin.py
rename from swh/web/tests/browse/views/test_origin.py
rename to swh/web/browse/tests/views/test_origin.py
diff --git a/swh/web/tests/browse/views/test_release.py b/swh/web/browse/tests/views/test_release.py
rename from swh/web/tests/browse/views/test_release.py
rename to swh/web/browse/tests/views/test_release.py
diff --git a/swh/web/tests/browse/views/test_revision.py b/swh/web/browse/tests/views/test_revision.py
rename from swh/web/tests/browse/views/test_revision.py
rename to swh/web/browse/tests/views/test_revision.py
diff --git a/swh/web/tests/browse/views/test_snapshot.py b/swh/web/browse/tests/views/test_snapshot.py
rename from swh/web/tests/browse/views/test_snapshot.py
rename to swh/web/browse/tests/views/test_snapshot.py
diff --git a/swh/web/tests/conftest.py b/swh/web/conftest.py
rename from swh/web/tests/conftest.py
rename to swh/web/conftest.py
--- a/swh/web/tests/conftest.py
+++ b/swh/web/conftest.py
@@ -10,7 +10,6 @@
import json
import os
import random
-import shutil
import sys
import time
from typing import Any, Dict, List, Optional
@@ -61,8 +60,6 @@
os.environ["LC_ALL"] = "C.UTF-8"
-fossology_missing = shutil.which("nomossa") is None
-
# Register some hypothesis profiles
hypothesis_settings.register_profile("default", hypothesis_settings())
@@ -122,13 +119,13 @@
if not os.path.exists(static_dir):
# location of the static folder when running tests locally with pytest
- static_dir = os.path.join(test_dir, "../../../static")
+ static_dir = os.path.join(test_dir, "../../static")
webpack_stats = os.path.join(static_dir, "webpack-stats.json")
if os.path.exists(webpack_stats):
return
- django_apps_dir = os.path.join(test_dir, "../../../swh/web")
+ django_apps_dir = os.path.join(test_dir, "../../swh/web")
if not os.path.exists(django_apps_dir):
# location of the applications folder when running tests with tox
django_apps_dir = os.path.join(data_dir, "swh/web")
@@ -148,8 +145,6 @@
):
bundles.append(app_bundle)
- print(bundles)
-
mock_webpack_stats = {
"status": "done",
"publicPath": "/static",
diff --git a/swh/web/tests/deposit/__init__.py b/swh/web/deposit/tests/__init__.py
rename from swh/web/tests/deposit/__init__.py
rename to swh/web/deposit/tests/__init__.py
diff --git a/swh/web/tests/deposit/test_app.py b/swh/web/deposit/tests/test_app.py
rename from swh/web/tests/deposit/test_app.py
rename to swh/web/deposit/tests/test_app.py
diff --git a/swh/web/tests/deposit/test_views.py b/swh/web/deposit/tests/test_views.py
rename from swh/web/tests/deposit/test_views.py
rename to swh/web/deposit/tests/test_views.py
diff --git a/swh/web/tests/inbound_email/__init__.py b/swh/web/inbound_email/tests/__init__.py
rename from swh/web/tests/inbound_email/__init__.py
rename to swh/web/inbound_email/tests/__init__.py
diff --git a/swh/web/tests/inbound_email/resources/__init__.py b/swh/web/inbound_email/tests/resources/__init__.py
rename from swh/web/tests/inbound_email/resources/__init__.py
rename to swh/web/inbound_email/tests/resources/__init__.py
diff --git a/swh/web/tests/inbound_email/resources/multipart_alternative.eml b/swh/web/inbound_email/tests/resources/multipart_alternative.eml
rename from swh/web/tests/inbound_email/resources/multipart_alternative.eml
rename to swh/web/inbound_email/tests/resources/multipart_alternative.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_alternative_html_only.eml b/swh/web/inbound_email/tests/resources/multipart_alternative_html_only.eml
rename from swh/web/tests/inbound_email/resources/multipart_alternative_html_only.eml
rename to swh/web/inbound_email/tests/resources/multipart_alternative_html_only.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_alternative_recursive.eml b/swh/web/inbound_email/tests/resources/multipart_alternative_recursive.eml
rename from swh/web/tests/inbound_email/resources/multipart_alternative_recursive.eml
rename to swh/web/inbound_email/tests/resources/multipart_alternative_recursive.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_alternative_text_only.eml b/swh/web/inbound_email/tests/resources/multipart_alternative_text_only.eml
rename from swh/web/tests/inbound_email/resources/multipart_alternative_text_only.eml
rename to swh/web/inbound_email/tests/resources/multipart_alternative_text_only.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_mixed.eml b/swh/web/inbound_email/tests/resources/multipart_mixed.eml
rename from swh/web/tests/inbound_email/resources/multipart_mixed.eml
rename to swh/web/inbound_email/tests/resources/multipart_mixed.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_mixed2.eml b/swh/web/inbound_email/tests/resources/multipart_mixed2.eml
rename from swh/web/tests/inbound_email/resources/multipart_mixed2.eml
rename to swh/web/inbound_email/tests/resources/multipart_mixed2.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_mixed_text_only.eml b/swh/web/inbound_email/tests/resources/multipart_mixed_text_only.eml
rename from swh/web/tests/inbound_email/resources/multipart_mixed_text_only.eml
rename to swh/web/inbound_email/tests/resources/multipart_mixed_text_only.eml
diff --git a/swh/web/tests/inbound_email/resources/multipart_related.eml b/swh/web/inbound_email/tests/resources/multipart_related.eml
rename from swh/web/tests/inbound_email/resources/multipart_related.eml
rename to swh/web/inbound_email/tests/resources/multipart_related.eml
diff --git a/swh/web/tests/inbound_email/resources/plaintext.eml b/swh/web/inbound_email/tests/resources/plaintext.eml
rename from swh/web/tests/inbound_email/resources/plaintext.eml
rename to swh/web/inbound_email/tests/resources/plaintext.eml
diff --git a/swh/web/tests/inbound_email/test_management_command.py b/swh/web/inbound_email/tests/test_management_command.py
rename from swh/web/tests/inbound_email/test_management_command.py
rename to swh/web/inbound_email/tests/test_management_command.py
diff --git a/swh/web/tests/inbound_email/test_utils.py b/swh/web/inbound_email/tests/test_utils.py
rename from swh/web/tests/inbound_email/test_utils.py
rename to swh/web/inbound_email/tests/test_utils.py
--- a/swh/web/tests/inbound_email/test_utils.py
+++ b/swh/web/inbound_email/tests/test_utils.py
@@ -319,7 +319,7 @@
def test_get_message_plaintext(
filename: str, expected_parts: List[bytes], expected_absent: List[bytes]
):
- with open_binary("swh.web.tests.inbound_email.resources", filename) as f:
+ with open_binary("swh.web.inbound_email.tests.resources", filename) as f:
message = email.message_from_binary_file(f, policy=email.policy.default)
assert isinstance(message, EmailMessage)
diff --git a/swh/web/tests/jslicenses/__init__.py b/swh/web/jslicenses/tests/__init__.py
rename from swh/web/tests/jslicenses/__init__.py
rename to swh/web/jslicenses/tests/__init__.py
diff --git a/swh/web/tests/jslicenses/test_app.py b/swh/web/jslicenses/tests/test_app.py
rename from swh/web/tests/jslicenses/test_app.py
rename to swh/web/jslicenses/tests/test_app.py
diff --git a/swh/web/tests/jslicenses/test_jslicenses.py b/swh/web/jslicenses/tests/test_jslicenses.py
rename from swh/web/tests/jslicenses/test_jslicenses.py
rename to swh/web/jslicenses/tests/test_jslicenses.py
diff --git a/swh/web/tests/mailmap/__init__.py b/swh/web/mailmap/tests/__init__.py
rename from swh/web/tests/mailmap/__init__.py
rename to swh/web/mailmap/tests/__init__.py
diff --git a/swh/web/tests/mailmap/test_app.py b/swh/web/mailmap/tests/test_app.py
rename from swh/web/tests/mailmap/test_app.py
rename to swh/web/mailmap/tests/test_app.py
diff --git a/swh/web/tests/mailmap/test_mailmap.py b/swh/web/mailmap/tests/test_mailmap.py
rename from swh/web/tests/mailmap/test_mailmap.py
rename to swh/web/mailmap/tests/test_mailmap.py
diff --git a/swh/web/tests/mailmap/test_migrations.py b/swh/web/mailmap/tests/test_migrations.py
rename from swh/web/tests/mailmap/test_migrations.py
rename to swh/web/mailmap/tests/test_migrations.py
diff --git a/swh/web/tests/metrics/__init__.py b/swh/web/metrics/tests/__init__.py
rename from swh/web/tests/metrics/__init__.py
rename to swh/web/metrics/tests/__init__.py
diff --git a/swh/web/tests/metrics/test_app.py b/swh/web/metrics/tests/test_app.py
rename from swh/web/tests/metrics/test_app.py
rename to swh/web/metrics/tests/test_app.py
diff --git a/swh/web/tests/metrics/test_metrics.py b/swh/web/metrics/tests/test_metrics.py
rename from swh/web/tests/metrics/test_metrics.py
rename to swh/web/metrics/tests/test_metrics.py
diff --git a/swh/web/tests/save_code_now/__init__.py b/swh/web/save_code_now/tests/__init__.py
rename from swh/web/tests/save_code_now/__init__.py
rename to swh/web/save_code_now/tests/__init__.py
diff --git a/swh/web/tests/save_code_now/data/http_esnode1.internal.softwareheritage.org/swh_workers-*__search b/swh/web/save_code_now/tests/data/http_esnode1.internal.softwareheritage.org/swh_workers-*__search
rename from swh/web/tests/save_code_now/data/http_esnode1.internal.softwareheritage.org/swh_workers-*__search
rename to swh/web/save_code_now/tests/data/http_esnode1.internal.softwareheritage.org/swh_workers-*__search
diff --git a/swh/web/tests/save_code_now/test_app.py b/swh/web/save_code_now/tests/test_app.py
rename from swh/web/tests/save_code_now/test_app.py
rename to swh/web/save_code_now/tests/test_app.py
diff --git a/swh/web/tests/save_code_now/test_django_command.py b/swh/web/save_code_now/tests/test_django_command.py
rename from swh/web/tests/save_code_now/test_django_command.py
rename to swh/web/save_code_now/tests/test_django_command.py
diff --git a/swh/web/tests/save_code_now/test_migrations.py b/swh/web/save_code_now/tests/test_migrations.py
rename from swh/web/tests/save_code_now/test_migrations.py
rename to swh/web/save_code_now/tests/test_migrations.py
diff --git a/swh/web/tests/save_code_now/test_origin_save.py b/swh/web/save_code_now/tests/test_origin_save.py
rename from swh/web/tests/save_code_now/test_origin_save.py
rename to swh/web/save_code_now/tests/test_origin_save.py
diff --git a/swh/web/tests/save_code_now/test_origin_save_admin.py b/swh/web/save_code_now/tests/test_origin_save_admin.py
rename from swh/web/tests/save_code_now/test_origin_save_admin.py
rename to swh/web/save_code_now/tests/test_origin_save_admin.py
diff --git a/swh/web/tests/save_code_now/test_origin_save_api.py b/swh/web/save_code_now/tests/test_origin_save_api.py
rename from swh/web/tests/save_code_now/test_origin_save_api.py
rename to swh/web/save_code_now/tests/test_origin_save_api.py
diff --git a/swh/web/tests/save_code_now/test_origin_save_views.py b/swh/web/save_code_now/tests/test_origin_save_views.py
rename from swh/web/tests/save_code_now/test_origin_save_views.py
rename to swh/web/save_code_now/tests/test_origin_save_views.py
diff --git a/swh/web/tests/save_origin_webhooks/__init__.py b/swh/web/save_origin_webhooks/tests/__init__.py
rename from swh/web/tests/save_origin_webhooks/__init__.py
rename to swh/web/save_origin_webhooks/tests/__init__.py
diff --git a/swh/web/tests/save_origin_webhooks/data/bitbucket_webhook_payload.json b/swh/web/save_origin_webhooks/tests/data/bitbucket_webhook_payload.json
rename from swh/web/tests/save_origin_webhooks/data/bitbucket_webhook_payload.json
rename to swh/web/save_origin_webhooks/tests/data/bitbucket_webhook_payload.json
diff --git a/swh/web/tests/save_origin_webhooks/data/gitea_webhook_payload.json b/swh/web/save_origin_webhooks/tests/data/gitea_webhook_payload.json
rename from swh/web/tests/save_origin_webhooks/data/gitea_webhook_payload.json
rename to swh/web/save_origin_webhooks/tests/data/gitea_webhook_payload.json
diff --git a/swh/web/tests/save_origin_webhooks/data/github_webhook_payload.json b/swh/web/save_origin_webhooks/tests/data/github_webhook_payload.json
rename from swh/web/tests/save_origin_webhooks/data/github_webhook_payload.json
rename to swh/web/save_origin_webhooks/tests/data/github_webhook_payload.json
diff --git a/swh/web/tests/save_origin_webhooks/data/gitlab_webhook_payload.json b/swh/web/save_origin_webhooks/tests/data/gitlab_webhook_payload.json
rename from swh/web/tests/save_origin_webhooks/data/gitlab_webhook_payload.json
rename to swh/web/save_origin_webhooks/tests/data/gitlab_webhook_payload.json
diff --git a/swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-git b/swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-git
rename from swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-git
rename to swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-git
diff --git a/swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-hg b/swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-hg
rename from swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-hg
rename to swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-hg
diff --git a/swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-svn b/swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-svn
rename from swh/web/tests/save_origin_webhooks/data/https_sourceforge.net/rest_p_webhook-test-svn
rename to swh/web/save_origin_webhooks/tests/data/https_sourceforge.net/rest_p_webhook-test-svn
diff --git a/swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_git.json b/swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_git.json
rename from swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_git.json
rename to swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_git.json
diff --git a/swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_hg.json b/swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_hg.json
rename from swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_hg.json
rename to swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_hg.json
diff --git a/swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_svn.json b/swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_svn.json
rename from swh/web/tests/save_origin_webhooks/data/sourceforge_webhook_payload_svn.json
rename to swh/web/save_origin_webhooks/tests/data/sourceforge_webhook_payload_svn.json
diff --git a/swh/web/tests/save_origin_webhooks/test_app.py b/swh/web/save_origin_webhooks/tests/test_app.py
rename from swh/web/tests/save_origin_webhooks/test_app.py
rename to swh/web/save_origin_webhooks/tests/test_app.py
diff --git a/swh/web/tests/save_origin_webhooks/test_bitbucket.py b/swh/web/save_origin_webhooks/tests/test_bitbucket.py
rename from swh/web/tests/save_origin_webhooks/test_bitbucket.py
rename to swh/web/save_origin_webhooks/tests/test_bitbucket.py
diff --git a/swh/web/tests/save_origin_webhooks/test_gitea.py b/swh/web/save_origin_webhooks/tests/test_gitea.py
rename from swh/web/tests/save_origin_webhooks/test_gitea.py
rename to swh/web/save_origin_webhooks/tests/test_gitea.py
diff --git a/swh/web/tests/save_origin_webhooks/test_github.py b/swh/web/save_origin_webhooks/tests/test_github.py
rename from swh/web/tests/save_origin_webhooks/test_github.py
rename to swh/web/save_origin_webhooks/tests/test_github.py
diff --git a/swh/web/tests/save_origin_webhooks/test_gitlab.py b/swh/web/save_origin_webhooks/tests/test_gitlab.py
rename from swh/web/tests/save_origin_webhooks/test_gitlab.py
rename to swh/web/save_origin_webhooks/tests/test_gitlab.py
diff --git a/swh/web/tests/save_origin_webhooks/test_sourceforge.py b/swh/web/save_origin_webhooks/tests/test_sourceforge.py
rename from swh/web/tests/save_origin_webhooks/test_sourceforge.py
rename to swh/web/save_origin_webhooks/tests/test_sourceforge.py
diff --git a/swh/web/tests/save_origin_webhooks/utils.py b/swh/web/save_origin_webhooks/tests/utils.py
rename from swh/web/tests/save_origin_webhooks/utils.py
rename to swh/web/save_origin_webhooks/tests/utils.py
diff --git a/swh/web/tests/helpers.py b/swh/web/tests/helpers.py
--- a/swh/web/tests/helpers.py
+++ b/swh/web/tests/helpers.py
@@ -3,6 +3,7 @@
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
+import shutil
from typing import Any, Dict, Optional, cast
from django.contrib.auth.models import Permission
@@ -265,3 +266,6 @@
content_type=content_type,
id=1000 + Permission.objects.count(),
)
+
+
+fossology_missing = shutil.which("nomossa") is None
diff --git a/swh/web/tests/resources/deposit/raw-metadata-add-to-origin.xml b/swh/web/tests/resources/deposit/raw-metadata-add-to-origin.xml
deleted file mode 100644
--- a/swh/web/tests/resources/deposit/raw-metadata-add-to-origin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- Awesome Compiler
- urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
- dudess
-
-
-
-
-
-
diff --git a/swh/web/tests/resources/deposit/raw-metadata-create-origin.xml b/swh/web/tests/resources/deposit/raw-metadata-create-origin.xml
deleted file mode 100644
--- a/swh/web/tests/resources/deposit/raw-metadata-create-origin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- Awesome Compiler
- urn:uuid:1225c695-cfb8-4ebb-daaaa-80da344efa6a
- dudess
-
-
-
-
-
-
diff --git a/swh/web/tests/resources/deposit/raw-metadata-no-swh.xml b/swh/web/tests/resources/deposit/raw-metadata-no-swh.xml
deleted file mode 100644
--- a/swh/web/tests/resources/deposit/raw-metadata-no-swh.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Awesome Compiler
- urn:uuid:1225c695-cfb8-4ebb-daaaa-80da344efa6a
- dudess
-
diff --git a/swh/web/tests/resources/deposit/raw-metadata-provenance.xml b/swh/web/tests/resources/deposit/raw-metadata-provenance.xml
deleted file mode 100644
--- a/swh/web/tests/resources/deposit/raw-metadata-provenance.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- Awesome Compiler
- urn:uuid:1225c695-cfb8-4ebb-daaaa-80da344efa6a
- dudess
-
-
- https://example.org/metadata/provenance
-
-
-
diff --git a/swh/web/tests/utils/__init__.py b/swh/web/utils/tests/__init__.py
rename from swh/web/tests/utils/__init__.py
rename to swh/web/utils/tests/__init__.py
diff --git a/swh/web/tests/utils/test_archive.py b/swh/web/utils/tests/test_archive.py
rename from swh/web/tests/utils/test_archive.py
rename to swh/web/utils/tests/test_archive.py
--- a/swh/web/tests/utils/test_archive.py
+++ b/swh/web/utils/tests/test_archive.py
@@ -27,8 +27,8 @@
)
from swh.model.swhids import ObjectType
from swh.storage.utils import now
-from swh.web.tests.conftest import fossology_missing
from swh.web.tests.data import random_content, random_sha1
+from swh.web.tests.helpers import fossology_missing
from swh.web.tests.strategies import new_origin, new_revision, visit_dates
from swh.web.utils import archive
from swh.web.utils.exc import BadInputExc, NotFoundExc
diff --git a/swh/web/tests/utils/test_converters.py b/swh/web/utils/tests/test_converters.py
rename from swh/web/tests/utils/test_converters.py
rename to swh/web/utils/tests/test_converters.py
diff --git a/swh/web/tests/utils/test_exc.py b/swh/web/utils/tests/test_exc.py
rename from swh/web/tests/utils/test_exc.py
rename to swh/web/utils/tests/test_exc.py
diff --git a/swh/web/tests/utils/test_highlightjs.py b/swh/web/utils/tests/test_highlightjs.py
rename from swh/web/tests/utils/test_highlightjs.py
rename to swh/web/utils/tests/test_highlightjs.py
diff --git a/swh/web/tests/utils/test_identifiers.py b/swh/web/utils/tests/test_identifiers.py
rename from swh/web/tests/utils/test_identifiers.py
rename to swh/web/utils/tests/test_identifiers.py
diff --git a/swh/web/tests/utils/test_middlewares.py b/swh/web/utils/tests/test_middlewares.py
rename from swh/web/tests/utils/test_middlewares.py
rename to swh/web/utils/tests/test_middlewares.py
diff --git a/swh/web/tests/utils/test_origin_visits.py b/swh/web/utils/tests/test_origin_visits.py
rename from swh/web/tests/utils/test_origin_visits.py
rename to swh/web/utils/tests/test_origin_visits.py
diff --git a/swh/web/tests/utils/test_query.py b/swh/web/utils/tests/test_query.py
rename from swh/web/tests/utils/test_query.py
rename to swh/web/utils/tests/test_query.py
diff --git a/swh/web/tests/utils/test_templatetags.py b/swh/web/utils/tests/test_templatetags.py
rename from swh/web/tests/utils/test_templatetags.py
rename to swh/web/utils/tests/test_templatetags.py
diff --git a/swh/web/tests/utils/test_utils.py b/swh/web/utils/tests/test_utils.py
rename from swh/web/tests/utils/test_utils.py
rename to swh/web/utils/tests/test_utils.py
diff --git a/swh/web/tests/vault/__init__.py b/swh/web/vault/tests/__init__.py
rename from swh/web/tests/vault/__init__.py
rename to swh/web/vault/tests/__init__.py
diff --git a/swh/web/tests/vault/test_apiviews.py b/swh/web/vault/tests/test_apiviews.py
rename from swh/web/tests/vault/test_apiviews.py
rename to swh/web/vault/tests/test_apiviews.py
diff --git a/swh/web/tests/vault/test_app.py b/swh/web/vault/tests/test_app.py
rename from swh/web/tests/vault/test_app.py
rename to swh/web/vault/tests/test_app.py
diff --git a/swh/web/tests/vault/test_views.py b/swh/web/vault/tests/test_views.py
rename from swh/web/tests/vault/test_views.py
rename to swh/web/vault/tests/test_views.py
diff --git a/swh/web/tests/webapp/__init__.py b/swh/web/webapp/tests/__init__.py
rename from swh/web/tests/webapp/__init__.py
rename to swh/web/webapp/tests/__init__.py
diff --git a/swh/web/tests/webapp/test_templates.py b/swh/web/webapp/tests/test_templates.py
rename from swh/web/tests/webapp/test_templates.py
rename to swh/web/webapp/tests/test_templates.py
diff --git a/swh/web/tests/webapp/test_views.py b/swh/web/webapp/tests/test_views.py
rename from swh/web/tests/webapp/test_views.py
rename to swh/web/webapp/tests/test_views.py