def test_remove_service_gdpr_data_no_url(profile, service): service_connection = ServiceConnectionFactory(profile=profile, service=service) with pytest.raises(MissingGDPRUrlException): service_connection.delete_gdpr_data(dry_run=True) with pytest.raises(MissingGDPRUrlException): service_connection.delete_gdpr_data()
def test_remove_service_gdpr_data_fail(profile, service, requests_mock): requests_mock.delete(f"{GDPR_URL}{profile.pk}", json={}, status_code=405) service_connection = ServiceConnectionFactory(profile=profile, service=service) with pytest.raises(requests.RequestException): service_connection.delete_gdpr_data(dry_run=True) with pytest.raises(requests.RequestException): service_connection.delete_gdpr_data()
def test_remove_service_gdpr_data_successful(profile, service, requests_mock): requests_mock.delete(f"{GDPR_URL}{profile.pk}", json={}, status_code=204) service_connection = ServiceConnectionFactory(profile=profile, service=service) dry_run_ok = service_connection.delete_gdpr_data(dry_run=True) real_ok = service_connection.delete_gdpr_data() assert dry_run_ok assert real_ok