refactor(access): Update Functional Metadata to use PyTest for Contact Model
ref: #761 #730
This commit is contained in:
24
app/access/tests/functional/contact/conftest.py
Normal file
24
app/access/tests/functional/contact/conftest.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from access.models.contact import Contact
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture( scope = 'class')
|
||||||
|
def model(request):
|
||||||
|
|
||||||
|
request.cls.model = Contact
|
||||||
|
|
||||||
|
yield request.cls.model
|
||||||
|
|
||||||
|
del request.cls.model
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope='function')
|
||||||
|
def create_serializer():
|
||||||
|
|
||||||
|
from access.serializers.entity_contact import ModelSerializer
|
||||||
|
|
||||||
|
|
||||||
|
yield ModelSerializer
|
@ -0,0 +1,65 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
from access.models.contact import Contact
|
||||||
|
|
||||||
|
from access.tests.functional.person.test_functional_person_metadata import (
|
||||||
|
PersonMetadataInheritedCases
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ContactMetadataTestCases(
|
||||||
|
PersonMetadataInheritedCases,
|
||||||
|
):
|
||||||
|
|
||||||
|
add_data: dict = {
|
||||||
|
'email': 'ipfunny@unit.test',
|
||||||
|
}
|
||||||
|
|
||||||
|
kwargs_create_item: dict = {
|
||||||
|
'email': 'ipweird@unit.test',
|
||||||
|
}
|
||||||
|
|
||||||
|
kwargs_create_item_diff_org: dict = {
|
||||||
|
'email': 'ipstrange@unit.test',
|
||||||
|
}
|
||||||
|
|
||||||
|
model = Contact
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ContactMetadataInheritedCases(
|
||||||
|
ContactMetadataTestCases,
|
||||||
|
):
|
||||||
|
|
||||||
|
model = None
|
||||||
|
|
||||||
|
kwargs_create_item: dict = {}
|
||||||
|
|
||||||
|
kwargs_create_item_diff_org: dict = {}
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpTestData(self):
|
||||||
|
|
||||||
|
self.kwargs_create_item = {
|
||||||
|
**super().kwargs_create_item,
|
||||||
|
**self.kwargs_create_item
|
||||||
|
}
|
||||||
|
|
||||||
|
self.kwargs_create_item_diff_org = {
|
||||||
|
**super().kwargs_create_item_diff_org,
|
||||||
|
**self.kwargs_create_item_diff_org
|
||||||
|
}
|
||||||
|
|
||||||
|
super().setUpTestData()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ContactMetadataTest(
|
||||||
|
ContactMetadataTestCases,
|
||||||
|
TestCase,
|
||||||
|
|
||||||
|
):
|
||||||
|
pass
|
Reference in New Issue
Block a user