RedHatInsights / insights-core

Insights Core is a data collection and processing framework used by Red Hat Insights
https://cloud.redhat.com/insights
Apache License 2.0
153 stars 183 forks source link

Fix skipped assertions for itests #4207

Closed loleary closed 2 months ago

loleary commented 2 months ago

All Pull Requests:

Check all that apply:

Complete Description of Additions/Changes:

Using run_test with expected parameter DOES NOT perform expected assertion if expected value evaluates to false. For example, if expected is an empty list or dict or str or a bool value of False. The result is that no assertion is performed meaning that when checking that an integration test for a condition, for example, returns False but it instead, in error, returns True, run_test does not perform the assertion giving the impression that the test passes even though it does not.

This change fixes this by using a default sentinel value for expected and always performing the assertion unless expected is the sentinel value.

This change required updating an existing integration test. Additionally, it is important to note that this change will result in existing integration tests to fail which have fallen victim to this bug as well as any calls to run_test that explicitly pass expected=None thinking that it should mean do not perform any assertions.

Lorquas commented 2 months ago

Can one of the admins verify this patch?