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

Using real data for unit test mocking #204

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

AndrewTwydell
Copy link
Contributor

@AndrewTwydell AndrewTwydell commented Jan 10, 2025

What It Does
Adapts SDK unit tests to use real CMCI responses for a more accurate behaviour.

Review Checklist
I certify that I have:

Additional Comments

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 28.25%. Comparing base (61f57a8) to head (9dfa2e8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   28.25%   28.25%           
=======================================
  Files         146      146           
  Lines        4987     4987           
  Branches      869      869           
=======================================
  Hits         1409     1409           
  Misses       3578     3578           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@davenice davenice left a comment

Choose a reason for hiding this comment

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

This looks good!

Great to use actual data.

We might find in the future we need to have specific data per test, rather than a generic set of mocks, but I imagine that the generic set will do us for a while!

@AndrewTwydell AndrewTwydell force-pushed the sdk-unit-mocking branch 3 times, most recently from 85af963 to 2dc5377 Compare January 20, 2025 10:22
@AndrewTwydell AndrewTwydell marked this pull request as ready for review January 20, 2025 10:22
@AndrewTwydell
Copy link
Contributor Author

@zFernand0 I'd like to run this by you, now that I've marked it ready for review - the only potential contentious point would be that I've changed the method we're mocking here.

We're unit testing getResource still, but I'm now mocking the XML response rather than the JSON parsed version of the XML, so if anything I'm now testing more?? The idea behind this was so we can test real CMCI error messages more easily, but I'd like to know if you're onboard with this style of testing or not! 😀

Signed-off-by: Andrew Twydell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review/QA
Development

Successfully merging this pull request may close these issues.

4 participants