Fix tests

Increased the version of pytest to make it work with py 3.10 [0].
The GET calls no longer return list but the object itself, fixed the
tests and assertions to account for that. The tests did not account for
the later added `allow_user_remove_domain` setting. And there were
issues with missing and non-stopped patchers/mocks.

Now all tests are at least passing.

[0] https://github.com/pytest-dev/pytest/pull/8540
This commit is contained in:
corubba 2022-05-19 00:53:05 +02:00 committed by Ymage
parent 44cf98a159
commit b9eb593acd
10 changed files with 153 additions and 20 deletions

View File

@ -22,7 +22,7 @@ Flask-SeaSurf==1.1.1
bravado-core==5.17.0 bravado-core==5.17.0
jsonschema[format]>=2.5.1,<4.0.0 # until https://github.com/Yelp/bravado-core/pull/385 jsonschema[format]>=2.5.1,<4.0.0 # until https://github.com/Yelp/bravado-core/pull/385
lima==0.5 lima==0.5
pytest==6.1.1 pytest==6.2.5
pytimeparse==1.1.8 pytimeparse==1.1.8
PyYAML==5.4 PyYAML==5.4
Flask-SSLify==0.1.5 Flask-SSLify==0.1.5

View File

@ -36,6 +36,8 @@ def load_data(setting_name, *args, **kwargs):
return 10 return 10
if setting_name == 'allow_user_create_domain': if setting_name == 'allow_user_create_domain':
return True return True
if setting_name == 'allow_user_remove_domain':
return True
@pytest.fixture @pytest.fixture
@ -131,6 +133,7 @@ def initial_apikey_data():
api_url_setting = Setting('pdns_api_url', pdns_api_url) api_url_setting = Setting('pdns_api_url', pdns_api_url)
api_key_setting = Setting('pdns_api_key', os.environ['PDNS_API_KEY']) api_key_setting = Setting('pdns_api_key', os.environ['PDNS_API_KEY'])
allow_create_domain_setting = Setting('allow_user_create_domain', True) allow_create_domain_setting = Setting('allow_user_create_domain', True)
allow_remove_domain_setting = Setting('allow_user_remove_domain', True)
try: try:
flask_migrate.upgrade() flask_migrate.upgrade()
@ -138,6 +141,7 @@ def initial_apikey_data():
db.session.add(api_url_setting) db.session.add(api_url_setting)
db.session.add(api_key_setting) db.session.add(api_key_setting)
db.session.add(allow_create_domain_setting) db.session.add(allow_create_domain_setting)
db.session.add(allow_remove_domain_setting)
test_user_apikey = app.config.get('TEST_USER_APIKEY') test_user_apikey = app.config.get('TEST_USER_APIKEY')
test_admin_apikey = app.config.get('TEST_ADMIN_APIKEY') test_admin_apikey = app.config.get('TEST_ADMIN_APIKEY')

View File

@ -39,7 +39,7 @@ class TestIntegrationApiApiKeyAdminUser(object):
assert res.status_code == 201 assert res.status_code == 201
apikey_url_format = "/api/v1/pdnsadmin/apikeys/{0}" apikey_url_format = "/api/v1/pdnsadmin/apikeys/{0}"
apikey_url = apikey_url_format.format(data[0]['id']) apikey_url = apikey_url_format.format(data['id'])
res = client.delete(apikey_url, headers=basic_auth_admin_headers) res = client.delete(apikey_url, headers=basic_auth_admin_headers)
@ -123,7 +123,7 @@ class TestIntegrationApiApiKeyAdminUser(object):
assert res.status_code == 201 assert res.status_code == 201
apikey_url_format = "/api/v1/pdnsadmin/apikeys/{0}" apikey_url_format = "/api/v1/pdnsadmin/apikeys/{0}"
apikey_url = apikey_url_format.format(data[0]['id']) apikey_url = apikey_url_format.format(data['id'])
res = client.delete(apikey_url, headers=basic_auth_admin_headers) res = client.delete(apikey_url, headers=basic_auth_admin_headers)
assert res.status_code == 204 assert res.status_code == 204

View File

@ -14,8 +14,10 @@ class IntegrationApiManagement(object):
assert res.status_code == status_code assert res.status_code == status_code
if res.status_code == 200: if res.status_code == 200:
data = res.get_json(force=True) data = res.get_json(force=True)
assert len(data) == 1 assert isinstance(data, dict)
return data[0] assert len(data) == 7
assert data.get('id', None)
return data
return None return None
def check_account(self, cmpdata, data=None): def check_account(self, cmpdata, data=None):
@ -37,8 +39,10 @@ class IntegrationApiManagement(object):
assert res.status_code == status_code assert res.status_code == status_code
if status_code == 200: if status_code == 200:
data = res.get_json(force=True) data = res.get_json(force=True)
assert len(data) == 1 assert isinstance(data, dict)
return data[0] assert len(data) == 7
assert data.get('id', None)
return data
return None return None
def check_user(self, cmpdata, data=None): def check_user(self, cmpdata, data=None):
@ -50,5 +54,5 @@ class IntegrationApiManagement(object):
elif key == 'role': elif key == 'role':
assert data[key]['name'] == cmpdata['role_name'] assert data[key]['name'] == cmpdata['role_name']
else: else:
assert key in ("id",) assert key in ("id","accounts",)
return data return data

View File

@ -89,8 +89,9 @@ class TestIntegrationApiManagementAdminUser(IntegrationApiManagement):
) )
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 200 assert res.status_code == 200
assert len(data) == 1 assert isinstance(data, dict)
data = data[0] assert len(data) == 7
assert data.get('id', None)
account_id = data["id"] account_id = data["id"]
for key, value in account_data.items(): for key, value in account_data.items():
assert data[key] == value assert data[key] == value
@ -142,10 +143,12 @@ class TestIntegrationApiManagementAdminUser(IntegrationApiManagement):
) )
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 201 assert res.status_code == 201
assert len(data) == 1 assert isinstance(data, dict)
assert len(data) == 6
assert data.get('id', None)
# Check user # Check user
user1 = self.check_user(user1_data, data[0]) user1 = self.check_user(user1_data, data)
user1_id = user1["id"] user1_id = user1["id"]
updated = user1_data.copy() updated = user1_data.copy()
@ -240,10 +243,12 @@ class TestIntegrationApiManagementAdminUser(IntegrationApiManagement):
) )
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 201 assert res.status_code == 201
assert len(data) == 1 assert isinstance(data, dict)
assert len(data) == 6
assert data.get('id', None)
# Check user # Check user
user1 = self.check_user(user1_data, data[0]) user1 = self.check_user(user1_data, data)
user1_id = user1["id"] user1_id = user1["id"]
# Assert test account has no users # Assert test account has no users

View File

@ -33,8 +33,8 @@ class TestIntegrationApiManagementUser(IntegrationApiManagement):
headers=basic_auth_user_headers) headers=basic_auth_user_headers)
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 200 assert res.status_code == 200
assert len(data) == 1, data assert data
self.user = data self.user = [data]
def test_accounts( def test_accounts(
self, client, initial_data, # noqa: F811 self, client, initial_data, # noqa: F811
@ -118,10 +118,12 @@ class TestIntegrationApiManagementUser(IntegrationApiManagement):
) )
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 201 assert res.status_code == 201
assert len(data) == 1 assert isinstance(data, dict)
assert len(data) == 6
assert data.get('id', None)
# Check user # Check user
user1 = self.check_user(user1_data, data[0]) user1 = self.check_user(user1_data, data)
user1_id = user1["id"] user1_id = user1["id"]
# Update to defaults (should fail) # Update to defaults (should fail)
@ -181,10 +183,12 @@ class TestIntegrationApiManagementUser(IntegrationApiManagement):
) )
data = res.get_json(force=True) data = res.get_json(force=True)
assert res.status_code == 201 assert res.status_code == 201
assert len(data) == 1 assert isinstance(data, dict)
assert len(data) == 6
assert data.get('id', None)
# Check user # Check user
user1 = self.check_user(user1_data, data[0]) user1 = self.check_user(user1_data, data)
user1_id = user1["id"] user1_id = user1["id"]
# Assert test account has no users # Assert test account has no users

View File

@ -27,6 +27,9 @@ class TestUnitApiZoneAdminApiKey(object):
self.github_setting_patcher = patch( self.github_setting_patcher = patch(
'powerdnsadmin.services.github.Setting', 'powerdnsadmin.services.github.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
self.azure_setting_patcher = patch(
'powerdnsadmin.services.azure.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.oidc_setting_patcher = patch( self.oidc_setting_patcher = patch(
'powerdnsadmin.services.oidc.Setting', 'powerdnsadmin.services.oidc.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
@ -54,6 +57,9 @@ class TestUnitApiZoneAdminApiKey(object):
self.mock_setting_patcher = patch( self.mock_setting_patcher = patch(
'powerdnsadmin.routes.api.Setting', 'powerdnsadmin.routes.api.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
self.mock_decorators_setting_patcher = patch(
'powerdnsadmin.decorators.Setting',
spec=powerdnsadmin.models.setting.Setting)
data = admin_apikey_data() data = admin_apikey_data()
api_key = ApiKey(desc=data['description'], api_key = ApiKey(desc=data['description'],
@ -63,6 +69,7 @@ class TestUnitApiZoneAdminApiKey(object):
self.mock_google_setting = self.google_setting_patcher.start() self.mock_google_setting = self.google_setting_patcher.start()
self.mock_github_setting = self.github_setting_patcher.start() self.mock_github_setting = self.github_setting_patcher.start()
self.mock_azure_setting = self.azure_setting_patcher.start()
self.mock_oidc_setting = self.oidc_setting_patcher.start() self.mock_oidc_setting = self.oidc_setting_patcher.start()
self.mock_helpers_setting = self.helpers_setting_patcher.start() self.mock_helpers_setting = self.helpers_setting_patcher.start()
self.mock_models_setting = self.models_setting_patcher.start() self.mock_models_setting = self.models_setting_patcher.start()
@ -75,17 +82,40 @@ class TestUnitApiZoneAdminApiKey(object):
self.mock_apikey = self.mock_apikey_patcher.start() self.mock_apikey = self.mock_apikey_patcher.start()
self.mock_hist = self.mock_hist_patcher.start() self.mock_hist = self.mock_hist_patcher.start()
self.mock_setting = self.mock_setting_patcher.start() self.mock_setting = self.mock_setting_patcher.start()
self.mock_decorators_setting = self.mock_decorators_setting_patcher.start()
self.mock_google_setting.return_value.get.side_effect = load_data self.mock_google_setting.return_value.get.side_effect = load_data
self.mock_github_setting.return_value.get.side_effect = load_data self.mock_github_setting.return_value.get.side_effect = load_data
self.mock_azure_setting.return_value.get.side_effect = load_data
self.mock_oidc_setting.return_value.get.side_effect = load_data self.mock_oidc_setting.return_value.get.side_effect = load_data
self.mock_helpers_setting.return_value.get.side_effect = load_data self.mock_helpers_setting.return_value.get.side_effect = load_data
self.mock_models_setting.return_value.get.side_effect = load_data self.mock_models_setting.return_value.get.side_effect = load_data
self.mock_domain_model_setting.return_value.get.side_effect = load_data self.mock_domain_model_setting.return_value.get.side_effect = load_data
self.mock_record_model_setting.return_value.get.side_effect = load_data self.mock_record_model_setting.return_value.get.side_effect = load_data
self.mock_server_model_setting.return_value.get.side_effect = load_data self.mock_server_model_setting.return_value.get.side_effect = load_data
self.mock_decorators_setting.return_value.get.side_effect = load_data
self.mock_apikey.return_value.is_validate.return_value = api_key self.mock_apikey.return_value.is_validate.return_value = api_key
yield
for patcher in [
self.google_setting_patcher,
self.github_setting_patcher,
self.azure_setting_patcher,
self.oidc_setting_patcher,
self.helpers_setting_patcher,
self.models_setting_patcher,
self.domain_model_setting_patcher,
self.record_model_setting_patcher,
self.server_model_setting_patcher,
self.mock_apikey_patcher,
self.mock_hist_patcher,
self.mock_setting_patcher,
self.mock_decorators_setting_patcher,
]:
patcher.stop()
def test_empty_get(self, client, common_data_mock, admin_apikey): def test_empty_get(self, client, common_data_mock, admin_apikey):
with patch('powerdnsadmin.routes.api.Domain') as mock_domain, \ with patch('powerdnsadmin.routes.api.Domain') as mock_domain, \
patch('powerdnsadmin.lib.utils.requests.get') as mock_get: patch('powerdnsadmin.lib.utils.requests.get') as mock_get:

View File

@ -22,6 +22,9 @@ class TestUnitApiZoneAdminUser(object):
self.github_setting_patcher = patch( self.github_setting_patcher = patch(
'powerdnsadmin.services.github.Setting', 'powerdnsadmin.services.github.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
self.azure_setting_patcher = patch(
'powerdnsadmin.services.azure.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.oidc_setting_patcher = patch( self.oidc_setting_patcher = patch(
'powerdnsadmin.services.oidc.Setting', 'powerdnsadmin.services.oidc.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
@ -57,6 +60,7 @@ class TestUnitApiZoneAdminUser(object):
self.mock_google_setting = self.google_setting_patcher.start() self.mock_google_setting = self.google_setting_patcher.start()
self.mock_github_setting = self.github_setting_patcher.start() self.mock_github_setting = self.github_setting_patcher.start()
self.mock_azure_setting = self.azure_setting_patcher.start()
self.mock_oidc_setting = self.oidc_setting_patcher.start() self.mock_oidc_setting = self.oidc_setting_patcher.start()
self.mock_base_route_user = self.base_route_user_patcher.start() self.mock_base_route_user = self.base_route_user_patcher.start()
self.mock_helpers_setting = self.helpers_setting_patcher.start() self.mock_helpers_setting = self.helpers_setting_patcher.start()
@ -74,6 +78,7 @@ class TestUnitApiZoneAdminUser(object):
self.mock_google_setting.return_value.get.side_effect = load_data self.mock_google_setting.return_value.get.side_effect = load_data
self.mock_github_setting.return_value.get.side_effect = load_data self.mock_github_setting.return_value.get.side_effect = load_data
self.mock_azure_setting.return_value.get.side_effect = load_data
self.mock_oidc_setting.return_value.get.side_effect = load_data self.mock_oidc_setting.return_value.get.side_effect = load_data
self.mock_helpers_setting.return_value.get.side_effect = load_data self.mock_helpers_setting.return_value.get.side_effect = load_data
self.mock_models_setting.return_value.get.side_effect = load_data self.mock_models_setting.return_value.get.side_effect = load_data
@ -91,6 +96,27 @@ class TestUnitApiZoneAdminUser(object):
self.mock_base_route_user.query.filter.return_value.first.return_value = self.mockk self.mock_base_route_user.query.filter.return_value.first.return_value = self.mockk
self.mock_base_route_user.return_value.is_validate.return_value = True self.mock_base_route_user.return_value.is_validate.return_value = True
yield
for patcher in [
self.google_setting_patcher,
self.github_setting_patcher,
self.azure_setting_patcher,
self.oidc_setting_patcher,
self.base_route_user_patcher,
self.helpers_setting_patcher,
self.models_setting_patcher,
self.domain_model_setting_patcher,
self.record_model_setting_patcher,
self.server_model_setting_patcher,
self.decorators_setting_patcher,
self.api_setting_patcher,
self.mock_user_patcher,
self.mock_hist_patcher,
]:
patcher.stop()
def test_empty_get(self, client, common_data_mock, def test_empty_get(self, client, common_data_mock,
basic_auth_admin_headers): basic_auth_admin_headers):
with patch('powerdnsadmin.routes.api.Domain') as mock_domain, \ with patch('powerdnsadmin.routes.api.Domain') as mock_domain, \

View File

@ -22,6 +22,9 @@ class TestUnitApiZoneUser(object):
self.github_setting_patcher = patch( self.github_setting_patcher = patch(
'powerdnsadmin.services.github.Setting', 'powerdnsadmin.services.github.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
self.azure_setting_patcher = patch(
'powerdnsadmin.services.azure.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.oidc_setting_patcher = patch( self.oidc_setting_patcher = patch(
'powerdnsadmin.services.oidc.Setting', 'powerdnsadmin.services.oidc.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
@ -57,6 +60,7 @@ class TestUnitApiZoneUser(object):
self.mock_google_setting = self.google_setting_patcher.start() self.mock_google_setting = self.google_setting_patcher.start()
self.mock_github_setting = self.github_setting_patcher.start() self.mock_github_setting = self.github_setting_patcher.start()
self.mock_azure_setting = self.azure_setting_patcher.start()
self.mock_oidc_setting = self.oidc_setting_patcher.start() self.mock_oidc_setting = self.oidc_setting_patcher.start()
self.mock_base_route_user = self.base_route_user_patcher.start() self.mock_base_route_user = self.base_route_user_patcher.start()
self.mock_helpers_setting = self.helpers_setting_patcher.start() self.mock_helpers_setting = self.helpers_setting_patcher.start()
@ -74,6 +78,7 @@ class TestUnitApiZoneUser(object):
self.mock_google_setting.return_value.get.side_effect = load_data self.mock_google_setting.return_value.get.side_effect = load_data
self.mock_github_setting.return_value.get.side_effect = load_data self.mock_github_setting.return_value.get.side_effect = load_data
self.mock_azure_setting.return_value.get.side_effect = load_data
self.mock_oidc_setting.return_value.get.side_effect = load_data self.mock_oidc_setting.return_value.get.side_effect = load_data
self.mock_helpers_setting.return_value.get.side_effect = load_data self.mock_helpers_setting.return_value.get.side_effect = load_data
self.mock_models_setting.return_value.get.side_effect = load_data self.mock_models_setting.return_value.get.side_effect = load_data
@ -91,6 +96,27 @@ class TestUnitApiZoneUser(object):
self.mock_base_route_user.query.filter.return_value.first.return_value = self.mockk self.mock_base_route_user.query.filter.return_value.first.return_value = self.mockk
self.mock_base_route_user.return_value.is_validate.return_value = True self.mock_base_route_user.return_value.is_validate.return_value = True
yield
for patcher in [
self.google_setting_patcher,
self.github_setting_patcher,
self.azure_setting_patcher,
self.oidc_setting_patcher,
self.base_route_user_patcher,
self.helpers_setting_patcher,
self.models_setting_patcher,
self.domain_model_setting_patcher,
self.record_model_setting_patcher,
self.server_model_setting_patcher,
self.decorators_setting_patcher,
self.api_setting_patcher,
self.mock_user_patcher,
self.mock_hist_patcher,
]:
patcher.stop()
def test_create_zone(self, client, common_data_mock, zone_data, def test_create_zone(self, client, common_data_mock, zone_data,
basic_auth_user_headers, created_zone_data): basic_auth_user_headers, created_zone_data):
with patch('powerdnsadmin.lib.helper.requests.request') as mock_post, \ with patch('powerdnsadmin.lib.helper.requests.request') as mock_post, \

View File

@ -25,6 +25,9 @@ class TestUnitApiZoneUserApiKey(object):
self.github_setting_patcher = patch( self.github_setting_patcher = patch(
'powerdnsadmin.services.github.Setting', 'powerdnsadmin.services.github.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
self.azure_setting_patcher = patch(
'powerdnsadmin.services.azure.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.oidc_setting_patcher = patch( self.oidc_setting_patcher = patch(
'powerdnsadmin.services.oidc.Setting', 'powerdnsadmin.services.oidc.Setting',
spec=powerdnsadmin.models.setting.Setting) spec=powerdnsadmin.models.setting.Setting)
@ -49,9 +52,16 @@ class TestUnitApiZoneUserApiKey(object):
self.mock_hist_patcher = patch( self.mock_hist_patcher = patch(
'powerdnsadmin.routes.api.History', 'powerdnsadmin.routes.api.History',
spec=powerdnsadmin.models.history.History) spec=powerdnsadmin.models.history.History)
self.mock_setting_patcher = patch(
'powerdnsadmin.routes.api.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.mock_decorators_setting_patcher = patch(
'powerdnsadmin.decorators.Setting',
spec=powerdnsadmin.models.setting.Setting)
self.mock_google_setting = self.google_setting_patcher.start() self.mock_google_setting = self.google_setting_patcher.start()
self.mock_github_setting = self.github_setting_patcher.start() self.mock_github_setting = self.github_setting_patcher.start()
self.mock_azure_setting = self.azure_setting_patcher.start()
self.mock_oidc_setting = self.oidc_setting_patcher.start() self.mock_oidc_setting = self.oidc_setting_patcher.start()
self.mock_helpers_setting = self.helpers_setting_patcher.start() self.mock_helpers_setting = self.helpers_setting_patcher.start()
self.mock_models_setting = self.models_setting_patcher.start() self.mock_models_setting = self.models_setting_patcher.start()
@ -63,15 +73,19 @@ class TestUnitApiZoneUserApiKey(object):
) )
self.mock_apikey = self.mock_apikey_patcher.start() self.mock_apikey = self.mock_apikey_patcher.start()
self.mock_hist = self.mock_hist_patcher.start() self.mock_hist = self.mock_hist_patcher.start()
self.mock_setting = self.mock_setting_patcher.start()
self.mock_decorators_setting = self.mock_decorators_setting_patcher.start()
self.mock_google_setting.return_value.get.side_effect = load_data self.mock_google_setting.return_value.get.side_effect = load_data
self.mock_github_setting.return_value.get.side_effect = load_data self.mock_github_setting.return_value.get.side_effect = load_data
self.mock_azure_setting.return_value.get.side_effect = load_data
self.mock_oidc_setting.return_value.get.side_effect = load_data self.mock_oidc_setting.return_value.get.side_effect = load_data
self.mock_helpers_setting.return_value.get.side_effect = load_data self.mock_helpers_setting.return_value.get.side_effect = load_data
self.mock_models_setting.return_value.get.side_effect = load_data self.mock_models_setting.return_value.get.side_effect = load_data
self.mock_domain_model_setting.return_value.get.side_effect = load_data self.mock_domain_model_setting.return_value.get.side_effect = load_data
self.mock_record_model_setting.return_value.get.side_effect = load_data self.mock_record_model_setting.return_value.get.side_effect = load_data
self.mock_server_model_setting.return_value.get.side_effect = load_data self.mock_server_model_setting.return_value.get.side_effect = load_data
self.mock_decorators_setting.return_value.get.side_effect = load_data
data = user_apikey_data() data = user_apikey_data()
domain = Domain(name=data['domains'][0]) domain = Domain(name=data['domains'][0])
@ -83,6 +97,26 @@ class TestUnitApiZoneUserApiKey(object):
self.mock_apikey.return_value.is_validate.return_value = api_key self.mock_apikey.return_value.is_validate.return_value = api_key
yield
for patcher in [
self.google_setting_patcher,
self.github_setting_patcher,
self.azure_setting_patcher,
self.oidc_setting_patcher,
self.helpers_setting_patcher,
self.models_setting_patcher,
self.domain_model_setting_patcher,
self.record_model_setting_patcher,
self.server_model_setting_patcher,
self.mock_apikey_patcher,
self.mock_hist_patcher,
self.mock_setting_patcher,
self.mock_decorators_setting_patcher,
]:
patcher.stop()
def test_create_zone(self, client, common_data_mock, zone_data, def test_create_zone(self, client, common_data_mock, zone_data,
user_apikey, created_zone_data): user_apikey, created_zone_data):
with patch('powerdnsadmin.lib.helper.requests.request') as mock_post, \ with patch('powerdnsadmin.lib.helper.requests.request') as mock_post, \