Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/data.py
# Copyright (C) 2018-2019 The Software Heritage developers | # Copyright (C) 2018-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from copy import deepcopy | |||||
import os | import os | ||||
import random | import random | ||||
from copy import deepcopy | |||||
from typing import Dict | |||||
from rest_framework.decorators import api_view | from rest_framework.decorators import api_view | ||||
from rest_framework.response import Response | from rest_framework.response import Response | ||||
from swh.indexer.fossology_license import FossologyLicenseIndexer | from swh.indexer.fossology_license import FossologyLicenseIndexer | ||||
from swh.indexer.mimetype import MimetypeIndexer | from swh.indexer.mimetype import MimetypeIndexer | ||||
from swh.indexer.ctags import CtagsIndexer | from swh.indexer.ctags import CtagsIndexer | ||||
from swh.indexer.storage import get_indexer_storage | from swh.indexer.storage import get_indexer_storage | ||||
▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | def override_storages(storage, idx_storage): | ||||
swh_config.update({'indexer_storage': idx_storage}) | swh_config.update({'indexer_storage': idx_storage}) | ||||
service.idx_storage = idx_storage | service.idx_storage = idx_storage | ||||
# Implement some special endpoints used to provide input tests data | # Implement some special endpoints used to provide input tests data | ||||
# when executing end to end tests with cypress | # when executing end to end tests with cypress | ||||
_content_code_data_exts = {} | _content_code_data_exts = {} # type: Dict[str, Dict[str, str]] | ||||
_content_code_data_filenames = {} | _content_code_data_filenames = {} # type: Dict[str, Dict[str, str]] | ||||
_content_other_data_exts = {} | _content_other_data_exts = {} # type: Dict[str, Dict[str, str]] | ||||
def _init_content_tests_data(data_path, data_dict, ext_key): | def _init_content_tests_data(data_path, data_dict, ext_key): | ||||
""" | """ | ||||
Helper function to read the content of a directory, store it | Helper function to read the content of a directory, store it | ||||
into a test archive and add some files metadata (sha1 and/or | into a test archive and add some files metadata (sha1 and/or | ||||
expected programming language) in a dict. | expected programming language) in a dict. | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |