-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implements a Context that talks to the store mock server #293
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
189e3ea
Implements the WinMockContext header
CarlosNihelton b8b92b0
Implements the call() HTTP function wrapper
CarlosNihelton 893dc4d
Moves to_hstrings() to a new header
CarlosNihelton de69f7a
Adds a Product factory fromJson
CarlosNihelton 752450e
Implements GetProducts
CarlosNihelton 09605ce
Implements AllLocallyAuthenticatedUserHashes
CarlosNihelton 13bd038
Implements GenerateUserJwt.
CarlosNihelton 7a78f2d
InitDialogs is NOOP for now
CarlosNihelton 3ccb3b4
Implements purchase
CarlosNihelton 9d029e4
Support for testing the services with the mock
CarlosNihelton 1615761
Turns fromJson into a Product constructor
CarlosNihelton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this simply mirrors the store context, but I'm thinking that, in both contexts, this assertion should also be run on Release (or remove it and let the server fail, doesn't really matter).
If we leave it as-is, we have diferent failure modes in Release and Debug, so we won't be testing the right thing. Maybe we can create a card and deal with these in a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of an assertion is to educate the programmers to ensure those checks won't be needed in release.
If we are unsure about whether we are safe to trust that those checks aren't needed in production, then we should revisit the usage of assertions and maybe convert into wide contracts with exceptions being thrown for invalid arguments.
I personally like assertions because they clearly state: "you'll called me outside of our contract, that's a bug, take your crash". Once we crash enough in debug mode, those checks shouldn't be necessary anymore. Exceptions are more fuzzy. What is an exceptional situation? As always, it depends...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having assertions mostly where an error is critical: to avoid segfaults or undefined behaviour. In this case, since this would error out anyways (just server-side), I'm not sure it is worth having a release/debug split. Particularly because we test error paths quite intensely, so we'd be testing a ficticious path here.
Since this is not performance-critital, it seems that it would not hurt to always return error, or to always let the server fail. Either way, this is not critical to this PR.