diff --git a/app/human_resources/tests/unit/employee/conftest.py b/app/human_resources/tests/unit/employee/conftest.py new file mode 100644 index 00000000..9300eb74 --- /dev/null +++ b/app/human_resources/tests/unit/employee/conftest.py @@ -0,0 +1,14 @@ +import pytest + +from human_resources.models.employee import Employee + + + +@pytest.fixture( scope = 'class') +def model(request): + + request.cls.model = Employee + + yield request.cls.model + + del request.cls.model diff --git a/app/human_resources/tests/unit/employee/test_unit_employee_api_fields.py b/app/human_resources/tests/unit/employee/test_unit_employee_api_fields.py new file mode 100644 index 00000000..2397edba --- /dev/null +++ b/app/human_resources/tests/unit/employee/test_unit_employee_api_fields.py @@ -0,0 +1,37 @@ +from access.tests.unit.contact.test_unit_contact_api_fields import ( + ContactAPIInheritedCases +) + + + +class EmployeeAPITestCases( + ContactAPIInheritedCases, +): + + parameterized_test_data = { + 'employee_number': { + 'expected': int + } + } + + kwargs_create_item: dict = { + 'employee_number': 12345, + } + + + +class EmployeeAPIInheritedCases( + EmployeeAPITestCases, +): + + kwargs_create_item: dict = None + + model = None + + + +class EmployeeAPIPyTest( + EmployeeAPITestCases, +): + + pass diff --git a/app/human_resources/tests/unit/employee/test_unit_employee_api_v2.py b/app/human_resources/tests/unit/employee/test_unit_employee_api_v2.py deleted file mode 100644 index b7db910c..00000000 --- a/app/human_resources/tests/unit/employee/test_unit_employee_api_v2.py +++ /dev/null @@ -1,73 +0,0 @@ -from django.test import TestCase - -from access.tests.unit.contact.test_unit_contact_api_v2 import ( - ContactAPIInheritedCases, -) - -from human_resources.models.employee import Employee - - - -class APITestCases( - ContactAPIInheritedCases, -): - - model = Employee - - kwargs_item_create: dict = { - 'email': 'ipfunny@unit.test', - 'employee_number': 123456, - } - - url_ns_name = '_api_v2_entity_sub' - - - def test_api_field_exists_employee_number(self): - """ Test for existance of API Field - - employee_number field must exist - """ - - assert 'employee_number' in self.api_data - - - def test_api_field_type_employee_number(self): - """ Test for type for API Field - - employee_number field must be str - """ - - assert type(self.api_data['employee_number']) is int - - - -class EmployeeAPIInheritedCases( - APITestCases, -): - """Sub-Entity Test Cases - - Test Cases for Entity models that inherit from model Employee - """ - - kwargs_item_create: dict = None - - model = None - - - @classmethod - def setUpTestData(self): - - self.kwargs_item_create.update( - super().kwargs_item_create - ) - - super().setUpTestData() - - - -class EmployeeAPITest( - APITestCases, - TestCase, -): - - pass