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

Added tests for getting game lists using serializers and the api-game… #336

Merged
merged 12 commits into from
Dec 7, 2023

Conversation

giomhern
Copy link
Contributor

@giomhern giomhern commented Nov 30, 2023

This is the pull request associated with issue #327 on creating more advanced and adequate checks are made on the Game List and that the Games produced with the factories are the same as those from the response.

@giomhern giomhern requested a review from cuyakonwu November 30, 2023 19:42
@giomhern giomhern linked an issue Nov 30, 2023 that may be closed by this pull request
@giomhern giomhern requested a review from majorsylvie November 30, 2023 19:47
Copy link
Contributor

@cuyakonwu cuyakonwu left a comment

Choose a reason for hiding this comment

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

Looks great, and is passing well!

@giomhern giomhern requested a review from cuyakonwu December 3, 2023 20:58
Copy link
Contributor

@cuyakonwu cuyakonwu left a comment

Choose a reason for hiding this comment

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

Passes all tests and looks good!

@giomhern giomhern self-assigned this Dec 5, 2023
@giomhern giomhern added the x/api label Dec 5, 2023
@giomhern giomhern added this to the 2023/Wrap-up milestone Dec 5, 2023
Copy link
Contributor

@majorsylvie majorsylvie left a comment

Choose a reason for hiding this comment

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

Nice additions, appreciate the import comments, think they work well.

Please add more body to a code comment but otherwise this is good to merge!

@@ -17,7 +21,14 @@ def check_equal(self, obj, expected: dict):
Helper function to check that the object data matches the expected data.
"""
for key in expected:
self.assertEqual(getattr(obj, key), expected[key])
if isinstance(obj, (ReturnDict, dict)):
# Use key indexing for dictionaries and ReturnDict
Copy link
Contributor

Choose a reason for hiding this comment

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

This should include a why in the code comment.
Why use/need key indexing for what attriutes.

@giomhern giomhern requested a review from majorsylvie December 7, 2023 20:26
Copy link
Contributor

@majorsylvie majorsylvie left a comment

Choose a reason for hiding this comment

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

Fantastic code comment!

Thank you for adding more tests.

With feedback addressed this is good to go.

Thank you for your work


# For example, without this check, you might encounter issues
# when comparing Decimal('5') and '5.00',
# which would fail due to type mismatch despite representing the same value.
Copy link
Contributor

Choose a reason for hiding this comment

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

Absolutely fantastic code comment.
Clear, direct, justified, with an example to boot!

Thank you for your work

@majorsylvie majorsylvie merged commit 2af4411 into dev Dec 7, 2023
2 checks passed
@majorsylvie majorsylvie deleted the apis/get-game-tests branch December 7, 2023 21:24
@giomhern
Copy link
Contributor Author

giomhern commented Dec 7, 2023

This PR, rooted in Issue #327, was focused on enhancing and ensuring that our GET API endpoint for games and the associated factory worked up to standards. Previously, we had an issue of mismatched values within the serialized and unserialized data which would cause the tests to fail. This has now been resolved in the helper function check_equal and the tests pass wonderfully!

Thank you to @giomhern for coding up the tests and @cuyakonwu for the help reviewing!

@majorsylvie
Copy link
Contributor

Issue Score: Excellent

Comments:
Great work!
Very very good closing comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Creating Test Cases: Game GET API Endpoint
3 participants