Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small test cleanup for Identity and Userdata controllers #2131

Merged

Conversation

Chris-Peterson444
Copy link
Collaborator

A couple of small fixes to some test code:

  • Remove an unnecessary usage of the SoureController in the IdentityController tests
  • Update the UserdataController tests so they are testing the expected behavior. Default usage of a mock object for the base_app attribute was hiding a failing test.

By letting the UserdataController use a mocked base_app, the tests
load_none, load_empty, and load_some don't actually verify the
inputs and only test that the data is loaded into the model. In
particular, the load_some test was loading bad cloud-config but still
had a passing test. Change the base_app attribute to actually be
a SubiquityModel by default.

Additionally, update the load_some test to not use bad cloud-config and
add a test to make sure validation errors are thrown on bad config.
Comment on lines +54 to +56
validate = (
self.controller.app.base_model.validate_cloudconfig_schema
) = mock.Mock()
Copy link
Member

@ogayot ogayot Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The joys of automatic code formatting 🤷‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know right 🙃

@Chris-Peterson444 Chris-Peterson444 merged commit fa1ec8c into canonical:main Jan 15, 2025
10 checks passed
@Chris-Peterson444 Chris-Peterson444 deleted the general-test-fixup branch January 15, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants