Skip to content

conftest#

load_test_json#

Source code in tests/unit/apps/core/api/conftest.py
def load_test_json(filename) -> Dict:
    with open(test_data_path + filename) as json_file:
        data = json.load(json_file)
    return data

api_client#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def api_client() -> APIClient:
    return APIClient()

legacy_contract_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def legacy_contract_json(client):
    return load_test_json("legacy_contract.json")

contract_a_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def contract_a_json(client):
    return load_test_json("contract_a.json")

contract_a#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def contract_a(admin_client, contract_a_json, data_catalog, reference_data):
    return admin_client.post("/v3/contracts", contract_a_json, content_type="application/json")

datacatalog_a_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_a_json():
    return load_test_json("datacatalog_a.json")

datacatalog_b_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_b_json():
    return load_test_json("datacatalog_b.json")

datacatalog_c_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_c_json():
    return load_test_json("datacatalog_c.json")

datacatalog_d_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_d_json():
    return load_test_json("datacatalog_d.json")

datacatalog_harvested_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_harvested_json(admin_client, data_catalog_list_url, reference_data):
    url = data_catalog_list_url
    datacatalog_json = load_test_json("datacatalog_harvested.json")
    res1 = admin_client.post(
        "/v3/data-catalogs", datacatalog_json, content_type="application/json"
    )
    return datacatalog_json

datacatalog_without_versioning#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_without_versioning() -> DataCatalog:
    identifier = "urn:nbn:fi:att:data-catalog-ida"
    title = {
        "en": "Datasets with versioning disabled",
    }
    return factories.DataCatalogFactory(
        id=identifier,
        title=title,
        dataset_versioning_enabled=False,
        allowed_pid_types=["URN", "DOI"],
    )

datacatalog_put_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_put_json():
    return load_test_json("datacatalog_put.json")

datacatalog_error_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def datacatalog_error_json():
    return load_test_json("datacatalog_error.json")

data_catalog_list_url#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture(scope="module")
def data_catalog_list_url():
    return reverse("datacatalog-list")

post_datacatalog_payloads_a_b_c#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def post_datacatalog_payloads_a_b_c(
    admin_client,
    datacatalog_a_json,
    datacatalog_b_json,
    datacatalog_c_json,
    reference_data,
    data_catalog_list_url,
):
    logger.info(__name__)
    url = data_catalog_list_url
    res1 = admin_client.post(url, datacatalog_a_json, content_type="application/json")
    res2 = admin_client.post(url, datacatalog_b_json, content_type="application/json")
    res3 = admin_client.post(url, datacatalog_c_json, content_type="application/json")
    logger.info(f"{res1=}, {res2=}, {res3=}")
    return res1, res2, res3

publisher_a_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_a_json():
    return load_test_json("publisher_a.json")

publisher_b_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_b_json():
    return load_test_json("publisher_b.json")

publisher_c_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_c_json():
    return load_test_json("publisher_c.json")

publisher_d_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_d_json():
    return load_test_json("publisher_d.json")

publisher_error_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_error_json():
    return load_test_json("publisher_error.json")

publisher_put_c_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def publisher_put_c_json():
    with open(test_data_path + "publisher_put_c.json") as json_file:
        data = json.load(json_file)

    return data

post_publisher_payloads_a_b_c_d#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def post_publisher_payloads_a_b_c_d(
    admin_client, publisher_a_json, publisher_b_json, publisher_c_json, publisher_d_json
):
    logger.info(__name__)
    url = "/v3/publishers"
    res1 = admin_client.post(url, publisher_a_json, content_type="application/json")
    res2 = admin_client.post(url, publisher_b_json, content_type="application/json")
    res3 = admin_client.post(url, publisher_c_json, content_type="application/json")
    res4 = admin_client.post(url, publisher_d_json, content_type="application/json")
    logger.info(f"{res1=}, {res2=}, {res3=}, {res4=}")
    return res1, res2, res3, res4

access_right_alfa_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def access_right_alfa_json():
    return load_test_json("access_right_alfa.json")

access_right_beta_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def access_right_beta_json():
    return load_test_json("access_right_beta.json")

access_right_gamma_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def access_right_gamma_json():
    return load_test_json("access_right_gamma.json")

access_right_delta_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def access_right_delta_json():
    return load_test_json("access_right_delta.json")

access_right_put_alfa_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def access_right_put_alfa_json():
    return load_test_json("access_right_put_alfa.json")

metadata_provider_a_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_a_json():
    return load_test_json("metadata_provider_a.json")

metadata_provider_b_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_b_json():
    return load_test_json("metadata_provider_b.json")

metadata_provider_c_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_c_json():
    return load_test_json("metadata_provider_c.json")

metadata_provider_d_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_d_json():
    return load_test_json("metadata_provider_d.json")

metadata_provider_error_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_error_json():
    return load_test_json("metadata_provider_error.json")

metadata_provider_put_c_json#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def metadata_provider_put_c_json():
    return load_test_json("metadata_provider_put_c.json")

post_metadata_provider_payloads_a_b_c_d#

Source code in tests/unit/apps/core/api/conftest.py
@pytest.fixture
def post_metadata_provider_payloads_a_b_c_d(
    admin_client,
    metadata_provider_a_json,
    metadata_provider_b_json,
    metadata_provider_c_json,
    metadata_provider_d_json,
):
    logger.info(__name__)
    url = "/v3/metadata-provider"
    res1 = admin_client.post(url, metadata_provider_a_json, content_type="application/json")
    res2 = admin_client.post(url, metadata_provider_b_json, content_type="application/json")
    res3 = admin_client.post(url, metadata_provider_c_json, content_type="application/json")
    res4 = admin_client.post(url, metadata_provider_d_json, content_type="application/json")
    logger.info(f"{res1=}, {res2=}, {res3=}, {res4=}")
    return res1, res2, res3, res4