test: Test Cases for TenancyObjects

!33 #15
This commit is contained in:
2024-06-20 03:07:39 +09:30
parent 6d3984f6e1
commit 7eb0651b89
4 changed files with 88 additions and 7 deletions

View File

@ -0,0 +1,68 @@
import pytest
import unittest
class TenancyObject:
""" Tests for checking TenancyObject """
model = None
""" Model to be tested """
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')
def test_has_attr_model_notes(self):
""" TenancyObject attribute check
TenancyObject has field model_notes
"""
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

View File

@ -48,4 +48,6 @@ Models are tested using the following test cases:
- [Notes Permissions](./notes_permissions.md)
- [Tenancy Objects](./model_tenancy_object.md)
The above test cases are common to alot of models and function of this application and are intended to be inherited by your test class.

View File

@ -0,0 +1,9 @@
---
title: Tenancy Object Entry Test Cases
description: No Fuss Computings model TenancyObject unit test cases
date: 2024-06-20
template: project.html
about: https://gitlab.com/nofusscomputing/infrastructure/configuration-management/django_app
---
::: app.access.tests.abstract.tenancy_object.TenancyObject

View File

@ -86,6 +86,14 @@ nav:
- projects/django-template/development/api/tests/index.md
- projects/django-template/development/api/tests/model_history.md
- projects/django-template/development/api/tests/model_history_child_item.md
- projects/django-template/development/api/tests/model_history_parent_item.md
- projects/django-template/development/api/tests/model_history_permissions.md
- projects/django-template/development/api/tests/model_permissions.md
- projects/django-template/development/api/tests/model_permissions_organization_manager.md
@ -116,13 +124,7 @@ nav:
- projects/django-template/development/api/tests/model_permission_api_view.md
- projects/django-template/development/api/tests/model_history.md
- projects/django-template/development/api/tests/model_history_child_item.md
- projects/django-template/development/api/tests/model_history_parent_item.md
- projects/django-template/development/api/tests/model_history_permissions.md
- projects/django-template/development/api/tests/model_tenancy_object.md
- projects/django-template/development/api/tests/notes_permissions.md