Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
fix: clear only the node_id in the router record
Browse files Browse the repository at this point in the history
Closes #401
  • Loading branch information
bbangert committed Mar 11, 2016
1 parent c233a20 commit d3cdee3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autopush/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def clear_node(self, item):
cond = "(node_id = :node) and (connected_at = :conn)"
conn.put_item(
self.table.table_name,
item=item.get_raw_keys(),
item=self.encode(item),
condition_expression=cond,
expression_attribute_values=self.encode({
":node": node_id,
Expand Down
7 changes: 6 additions & 1 deletion autopush/tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,18 +478,23 @@ def test_node_clear(self):

# Register a node user
router.register_user(dict(uaid=dummy_uaid, node_id="asdf",
connected_at=1234))
connected_at=1234,
router_key="webpush"))

# Verify
user = router.get_uaid(dummy_uaid)
eq_(user["node_id"], "asdf")
eq_(user["connected_at"], 1234)
eq_(user["router_key"], "webpush")

# Clear
router.clear_node(user)

# Verify
user = router.get_uaid(dummy_uaid)
eq_(user.get("node_id"), None)
eq_(user["connected_at"], 1234)
eq_(user["router_key"], "webpush")

def test_node_clear_fail(self):
r = get_router_table()
Expand Down

0 comments on commit d3cdee3

Please sign in to comment.