This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
bug: fix up AWS conditional binding and assoc. conditions #532
Conversation
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
Current coverage is 100%@@ master #532 diff @@
======================================
Files 40 40
Lines 8352 8365 +13
Methods 0 0
Messages 0 0
Branches 0 0
======================================
+ Hits 8348 8365 +17
+ Misses 4 0 -4
Partials 0 0
|
@@ -582,6 +582,9 @@ def register_user(self, data): | |||
conn = self.table.connection | |||
db_key = self.encode({"uaid": hasher(data["uaid"])}) | |||
del data["uaid"] | |||
if "router_type" not in data or "connected_at" not in data: | |||
# Not specifying these values will generate an exception in AWS. | |||
return (False, {}, data) |
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.
Is this going to accidentally mask a call that thinks the condition is failing vs. being called with incorrect data?
try: | ||
router.register_user(dict(uaid=uaid)) | ||
except: | ||
pass | ||
self.assertRaises(ItemNotFound, router.get_uaid, uaid) | ||
self.assertRaises(ItemNotFound, router.table.get_item, | ||
consistent=True, uaid=uaid) | ||
assert(router.drop_user.called) |
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.
ok_
r+ with 2 minor nits |
AWS throws an exception if conditional args are not defined, this impacted tests by failing, but throwing an exception and causing fun havoc. register_user now fails if all conditionals are not met (preserving previous behaviors). Added tests for older records that may be incomplete. Some formatting fixes included as well
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
AWS throws an exception if conditional args are not defined, this
impacted tests by failing, but throwing an exception and causing fun
havoc. register_user now fails if all conditionals are not met
(preserving previous behaviors). Added tests for older records that may
be incomplete.
Some formatting fixes included as well
@bbangert r?