Skip to content

Model Test Cases


Base Unit Tests for all models

Abstract test class containing test cases for all models.

Test cases for all models

Attributes

model = None

Model to test

Functions

test_class_inherits_save_history()

Confirm class inheritence

TenancyObject must inherit SaveHistory

test_attribute_exists_ordering()

Test for existance of field in <model>.Meta

Attribute ordering must be defined in Meta class.

test_attribute_not_empty_ordering()

Test field <model>.Meta is not empty

Attribute ordering must contain values

test_attribute_type_ordering()

Test field <model>.Meta is not empty

Attribute ordering must be of type list.

test_model_fields_parameter_mandatory_has_no_default()

Test Field called with Parameter

Test skipped

fields dont have enough info to determine if mandatory, so this item can't be tested.

Some fields can be set as null=false with blank=false however default=<value> ensures it's populated with a desired default.

If a field is set as null=false, there must not be a default parameter

test_model_fields_parameter_has_help_text()

Test Field called with Parameter

During field creation, it should have been called with paramater help_text

test_model_fields_parameter_type_help_text()

Test Field called with Parameter

During field creation, paramater help_text must be of type str

test_model_fields_parameter_not_empty_help_text()

Test Field called with Parameter

During field creation, paramater help_text must not be None or empty ('')

test_model_fields_parameter_has_verbose_name()

Test Field called with Parameter

During field creation, it should have been called with paramater verbose_name

test_model_fields_parameter_type_verbose_name()

Test Field called with Parameter

During field creation, paramater verbose_name must be of type str

test_model_fields_parameter_not_empty_verbose_name()

Test Field called with Parameter

During field creation, paramater verbose_name must not be None or empty ('')

test_attribute_exists_get_url()

Test for existance of field in <model>

Attribute get_url must be defined in class.

test_attribute_not_empty_get_url()

Test field <model> is not empty

Attribute get_url must contain values

test_attribute_type_get_url()

Test field <model>type

Attribute get_url must be str

test_attribute_callable_get_url()

Test field <model> callable

Attribute get_url must be a function

Tenancy model Unit Tests

Abstract test class containing test cases for Tenancy Object models

Bases: BaseModel, TenancyObject, Models

Test cases for tenancy models

Attributes

model = None

Model to test

Functions

test_class_inherits_save_history()

Confirm class inheritence

TenancyObject must inherit SaveHistory

test_attribute_exists_ordering()

Test for existance of field in <model>.Meta

Attribute ordering must be defined in Meta class.

test_attribute_not_empty_ordering()

Test field <model>.Meta is not empty

Attribute ordering must contain values

test_attribute_type_ordering()

Test field <model>.Meta is not empty

Attribute ordering must be of type list.

test_model_fields_parameter_mandatory_has_no_default()

Test Field called with Parameter

Test skipped

fields dont have enough info to determine if mandatory, so this item can't be tested.

Some fields can be set as null=false with blank=false however default=<value> ensures it's populated with a desired default.

If a field is set as null=false, there must not be a default parameter

test_model_fields_parameter_has_help_text()

Test Field called with Parameter

During field creation, it should have been called with paramater help_text

test_model_fields_parameter_type_help_text()

Test Field called with Parameter

During field creation, paramater help_text must be of type str

test_model_fields_parameter_not_empty_help_text()

Test Field called with Parameter

During field creation, paramater help_text must not be None or empty ('')

test_model_fields_parameter_has_verbose_name()

Test Field called with Parameter

During field creation, it should have been called with paramater verbose_name

test_model_fields_parameter_type_verbose_name()

Test Field called with Parameter

During field creation, paramater verbose_name must be of type str

test_model_fields_parameter_not_empty_verbose_name()

Test Field called with Parameter

During field creation, paramater verbose_name must not be None or empty ('')

test_attribute_exists_get_url()

Test for existance of field in <model>

Attribute get_url must be defined in class.

test_attribute_not_empty_get_url()

Test field <model> is not empty

Attribute get_url must contain values

test_attribute_type_get_url()

Test field <model>type

Attribute get_url must be str

test_attribute_callable_get_url()

Test field <model> callable

Attribute get_url must be a function

test_field_exists_verbose_name_plural()

Test for existance of field in <model>.Meta

Field is required for templates/detail.html.js

Attribute verbose_name_plural must be defined in Meta class.

test_field_not_empty_verbose_name_plural()

Test field <model>.Meta is not empty

Field is required for templates/detail.html.js

Attribute verbose_name_plural must be defined in Meta class.

test_field_type_verbose_name_plural()

Test field <model>.Meta is not empty

Field is required for templates/detail.html.js

Attribute verbose_name_plural must be of type str.

test_field_exists_verbose_name()

Test for existance of field in <model>.Meta

Field is required for templates/detail.html.js

Attribute verbose_name must be defined in Meta class.

test_field_not_empty_verbose_name()

Test field <model>.Meta is not empty

Field is required for templates/detail.html.js

Attribute verbose_name must be defined in Meta class.

test_field_type_verbose_name()

Test field <model>.Meta is not empty

Field is required for templates/detail.html.js

Attribute verbose_name must be of type str.

test_attribute_exists_table_fields()

Attrribute Test, Exists

Ensure attribute table_fields exists

test_attribute_type_table_fields()

Attrribute Test, Type

Ensure attribute table_fields is of type list

test_attribute_not_callable_table_fields()

Attrribute Test, Not Callable

Attribute must be a property

Ensure attribute table_fields is not callable.

test_attribute_exists_page_layout()

Attrribute Test, Exists

Ensure attribute page_layout exists

test_attribute_type_page_layout()

Attrribute Test, Type

Ensure attribute page_layout is of type list

test_attribute_not_callable_page_layout()

Attrribute Test, Not Callable

Attribute must be a property

Ensure attribute page_layout is not callable.

About:

This page forms part of our Project Centurion ERP.

Page Metadata
Version: ToDo: place files short git commit here
Date Created: 2024-07-15
Date Edited: 2024-07-15

Contribution:

Would You like to contribute to our Centurion ERP project? You can assist in the following ways:

 

ToDo: Add the page list of contributors