Skip to content

conftest#

admin_client#

Parameters:

Name Type Description Default
admin_user

pytest-django fixture with admin privileges

required

Returns:

Source code in tests/behave/features/datacatalog/conftest.py
@pytest.fixture
@given("the user has admin privileges")
def admin_client(admin_user):
    """

    Args:
        admin_user (): pytest-django fixture with admin privileges

    Returns:

    """
    client = APIClient()
    client.force_authenticate(user=admin_user)
    return client

datacatalog_json#

TODO: Should unify payload generation in tests

Source code in tests/behave/features/datacatalog/conftest.py
@pytest.fixture
def datacatalog_json():
    """

    Returns: json-object with DataCatalog POST-Request payload
    TODO:
        Should unify payload generation in tests

    """
    data = json.dumps(
        {
            "title": {"en": "Testing catalog", "fi": "Testi katalogi"},
            "language": [
                {
                    "url": "http://lexvo.org/id/iso639-3/fin",
                }
            ],
            "harvested": False,
            "publisher": {
                "name": {"en": "Testing", "fi": "Testi"},
                "homepage": [
                    {
                        "title": {
                            "en": "Publisher organization website",
                            "fi": "Julkaisijaorganisaation kotisivu",
                        },
                        "url": "http://www.testi.fi/",
                    }
                ],
            },
            "id": "urn:nbn:fi:att:data-catalog-testi",
            "dataset_versioning_enabled": False,
        }
    )
    return data