@ -14,57 +14,60 @@ from app.tests.common import DoesNotExist
|
||||
|
||||
|
||||
class APIFieldsTestCases:
|
||||
|
||||
api_fields_common = {
|
||||
'id': {
|
||||
'expected': int
|
||||
},
|
||||
'display_name': {
|
||||
'expected': str
|
||||
},
|
||||
'_urls': {
|
||||
'expected': dict
|
||||
},
|
||||
'_urls._self': {
|
||||
'expected': str
|
||||
},
|
||||
'_urls.notes': {
|
||||
'expected': str
|
||||
},
|
||||
}
|
||||
|
||||
api_fields_model = {
|
||||
'model_notes': {
|
||||
'expected': str
|
||||
},
|
||||
'created': {
|
||||
'expected': str
|
||||
},
|
||||
'modified': {
|
||||
'expected': str
|
||||
},
|
||||
}
|
||||
@property
|
||||
def parameterized_test_data(self) -> dict:
|
||||
|
||||
api_fields_tenancy = {
|
||||
'organization': {
|
||||
'expected': dict
|
||||
},
|
||||
'organization.id': {
|
||||
'expected': int
|
||||
},
|
||||
'organization.display_name': {
|
||||
'expected': str
|
||||
},
|
||||
'organization.url': {
|
||||
'expected': Hyperlink
|
||||
},
|
||||
}
|
||||
api_fields_common = {
|
||||
'id': {
|
||||
'expected': int
|
||||
},
|
||||
'display_name': {
|
||||
'expected': str
|
||||
},
|
||||
'_urls': {
|
||||
'expected': dict
|
||||
},
|
||||
'_urls._self': {
|
||||
'expected': str
|
||||
},
|
||||
'_urls.notes': {
|
||||
'expected': str
|
||||
},
|
||||
}
|
||||
|
||||
parameterized_test_data = {
|
||||
**api_fields_common,
|
||||
**api_fields_tenancy,
|
||||
**api_fields_model,
|
||||
}
|
||||
api_fields_model = {
|
||||
'model_notes': {
|
||||
'expected': str
|
||||
},
|
||||
'created': {
|
||||
'expected': str
|
||||
},
|
||||
'modified': {
|
||||
'expected': str
|
||||
},
|
||||
}
|
||||
|
||||
api_fields_tenancy = {
|
||||
'organization': {
|
||||
'expected': dict
|
||||
},
|
||||
'organization.id': {
|
||||
'expected': int
|
||||
},
|
||||
'organization.display_name': {
|
||||
'expected': str
|
||||
},
|
||||
'organization.url': {
|
||||
'expected': Hyperlink
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
**api_fields_common.copy(),
|
||||
**api_fields_tenancy.copy(),
|
||||
**api_fields_model.copy(),
|
||||
}
|
||||
|
||||
url_view_kwargs = {}
|
||||
|
||||
@ -229,3 +232,5 @@ class APIFieldsInheritedCases(
|
||||
):
|
||||
|
||||
model = None
|
||||
|
||||
parameterized_test_data = {}
|
@ -94,6 +94,10 @@ def pytest_generate_tests(metafunc):
|
||||
|
||||
base_values = getattr(base, 'parameterized_' + parameterized_key, None)
|
||||
|
||||
if isinstance(base_values, property):
|
||||
|
||||
base_values = getattr(base(), 'parameterized_' + parameterized_key, None)
|
||||
|
||||
if not isinstance(base_values, dict):
|
||||
|
||||
continue
|
||||
|
Reference in New Issue
Block a user