Skip to content

test_delete#

exists_datacatalog#

Returns:

Name Type Description
DataCatalog DataCatalog

New data-catalog instance

Source code in tests/behave/features/datacatalog/test_delete.py
@given("there is an existing data-catalog", target_fixture="data_catalog")
def exists_datacatalog(reference_data) -> DataCatalog:
    """

    Returns:
        DataCatalog: New data-catalog instance

    """
    return factories.DataCatalogFactory()

remove_datacatalog#

Parameters:

Name Type Description Default
data_catalog DataCatalog

Data-catalog used as kwarg for detail-view

required
admin_client

Authenticated admin client

required

Returns: Response object

Source code in tests/behave/features/datacatalog/test_delete.py
@when("the user removes the data-catalog", target_fixture="datacatalog_delete_request")
def remove_datacatalog(data_catalog, admin_client, reference_data):
    """

    Args:
        data_catalog (DataCatalog): Data-catalog used as kwarg for detail-view
        admin_client (): Authenticated admin client

    Returns: Response object

    """
    url = reverse("datacatalog-detail", kwargs={"pk": data_catalog.id})
    response = admin_client.delete(url)
    return response

is_datacatalog_soft_deleted#

Parameters:

Name Type Description Default
data_catalog DataCatalog

Deleted data-catalog instance

required
Source code in tests/behave/features/datacatalog/test_delete.py
@then("the data-catalog is soft deleted")
def is_datacatalog_soft_deleted(data_catalog):
    """

    Args:
        data_catalog (DataCatalog): Deleted data-catalog instance

    """
    assert DataCatalog.available_objects.filter(id=data_catalog.id).count() == 0
    assert DataCatalog.all_objects.filter(id=data_catalog.id).count() == 1

is_response_delete_ok#

Parameters:

Name Type Description Default
datacatalog_delete_request

Response object from DELETE-request

required
Source code in tests/behave/features/datacatalog/test_delete.py
@then("the user should get an OK delete-response")
def is_response_delete_ok(datacatalog_delete_request):
    """

    Args:
        datacatalog_delete_request (): Response object from DELETE-request

    """
    assert datacatalog_delete_request.status_code == 204

test_delete_datacatalog#

Source code in tests/behave/features/datacatalog/test_delete.py
@scenario("datacatalog.feature", "Deleting data-catalog")
@pytest.mark.django_db
def test_delete_datacatalog():
    assert True