test: Consolidate All model tests to remove duplicates and to simplify

ref: #719 #708
This commit is contained in:
2025-04-13 01:02:15 +09:30
parent 507c42faea
commit e4588771e8
32 changed files with 1393 additions and 1225 deletions

View File

@ -1,7 +1,3 @@
import pytest
import unittest
from access.models.tenancy import TenancyManager
@ -19,83 +15,18 @@ class TenancyObject:
"""
def test_history_save(self):
"""Confirm the desired intent for saving model history."""
# def test_history_save(self):
# """Confirm the desired intent for saving model history."""
assert self.model.save_model_history == self.should_model_history_be_saved
def test_has_attr_get_organization(self):
""" TenancyObject attribute check
TenancyObject has function get_organization
"""
assert hasattr(self.model, 'get_organization')
def test_has_attr_is_global(self):
""" TenancyObject attribute check
TenancyObject has field is_global
"""
assert hasattr(self.model, 'is_global')
# assert self.model.save_model_history == self.should_model_history_be_saved
def test_has_attr_model_notes(self):
""" TenancyObject attribute check
# @pytest.mark.skip(reason="to be written")
# def test_edit_no_organization_fails(self):
# """ Devices must be assigned an organization
TenancyObject has field model_notes
"""
# Must not be able to edit an item without an organization
# """
# pass
assert hasattr(self.model, 'model_notes')
def test_has_attr_organization(self):
""" TenancyObject attribute check
TenancyObject has field organization
"""
assert hasattr(self.model, 'organization')
@pytest.mark.skip(reason="to be written")
def test_create_no_organization_fails(self):
""" Devices must be assigned an organization
Must not be able to create an item without an organization
"""
pass
@pytest.mark.skip(reason="to be written")
def test_edit_no_organization_fails(self):
""" Devices must be assigned an organization
Must not be able to edit an item without an organization
"""
pass
def test_has_attr_organization(self):
""" TenancyObject attribute check
TenancyObject has function objects
"""
assert hasattr(self.model, 'objects')
def test_attribute_is_type_objects(self):
""" Attribute Check
attribute `objects` must be set to `access.models.TenancyManager()`
"""
assert type(self.model.objects) is TenancyManager