Skip to content

Expand unit tests for ObjectChange and testing asserts #21361

@arthanson

Description

@arthanson

NetBox version

v4.5.2

Feature type

Other

Proposed functionality

Currently there are some basic tests for ObjectChange records in netbox/utilities/testing/views.py these are run for all models, however they only test that an ObjectChange was created (or deleted) and don't test several critical pieces of functionality like prechange and postchange data.

This FR is to look at adding tests to these for checking prechange and postchange data where possible, or expanding the tests so that tests can be done that a single ObjectChange is created and that the prechange and postchange data match what was expected.

It would also probably be beneficial to add specific assert functions specific to ObjectChange something like assert_prechange_data_equals or such that can be used in tests.

Use case

ObjectChange handling is central to NetBox and netbox-branching is completely driven off of it, so it is critical that it works correctly and it thoroughly tested. There have also been several very serious bugs in netbox-branching due to errors in incorrectly created ObjectChange records. There are some basic tests for all models in netbox/utilities/testing/views.py and these could be fairly easily expanded.

Database changes

N/A

External dependencies

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    netboxstatus: needs triageThis issue is awaiting triage by a maintainertype: featureIntroduction of new functionality to the application

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions