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

Add test for REST API GET/PUT round-trip #3714

Merged
merged 2 commits into from
May 9, 2023

Conversation

glennmatthews
Copy link
Contributor

@glennmatthews glennmatthews commented May 8, 2023

Closes: #DNE

What's Changed

Testing idea that came out of a recent code review (I don't recall the specific one) - make sure the REST API is round-trip capable, i.e. that a client can GET an object, make any (or none) desired changes to the returned object, and send it back in via a PUT without needing to do any massaging of the object data to make it acceptable.

I've implemented this as a generic API test case, and fixed a number of issues it uncovered:

  • Choices fields are represented in GET response as {value: X, label: Y} but didn't support this format on write.
  • Interface.mac_address and VMInterface.mac_address are nullable, but the API wasn't permitting a client to send null values for these fields.
  • DeviceType.front_image and DeviceType.rear_image similarly are nullable but were not marked as such in the API.
  • Fixed an unrelated warning I saw in the test logs where we were passing timezone-naive datetimes when creating JobResults in one test.
  • User.password was incorrectly marked as a required API field on write.

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • n/a Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • n/a Documentation Updates (when adding/changing features)
  • n/a Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@glennmatthews glennmatthews self-assigned this May 8, 2023
@glennmatthews glennmatthews merged commit 5991a9a into next May 9, 2023
19 checks passed
@glennmatthews glennmatthews deleted the u/glennmatthews-api-round-trip-test branch May 9, 2023 12:33
@bryanculver bryanculver added the type: housekeeping Changes to the application which do not directly impact the end user label May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: housekeeping Changes to the application which do not directly impact the end user
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants