本文整理汇总了Python中autopush.db.Router.get_uaid方法的典型用法代码示例。如果您正苦于以下问题:Python Router.get_uaid方法的具体用法?Python Router.get_uaid怎么用?Python Router.get_uaid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autopush.db.Router
的用法示例。
在下文中一共展示了Router.get_uaid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_uaid_provision_failed
# 需要导入模块: from autopush.db import Router [as 别名]
# 或者: from autopush.db.Router import get_uaid [as 别名]
def test_uaid_provision_failed(self):
r = get_router_table()
router = Router(r, SinkMetrics())
router.table = Mock()
def raise_error(*args, **kwargs):
raise ProvisionedThroughputExceededException(None, None)
router.table.get_item.side_effect = raise_error
with self.assertRaises(ProvisionedThroughputExceededException):
router.get_uaid(uaid="asdf")
示例2: test_node_clear
# 需要导入模块: from autopush.db import Router [as 别名]
# 或者: from autopush.db.Router import get_uaid [as 别名]
def test_node_clear(self):
r = get_router_table()
router = Router(r, SinkMetrics())
# Register a node user
router.register_user(dict(uaid="asdf", node_id="asdf", connected_at=1234))
# Verify
user = router.get_uaid("asdf")
eq_(user["node_id"], "asdf")
# Clear
router.clear_node(user)
# Verify
user = router.get_uaid("asdf")
eq_(user.get("node_id"), None)
示例3: test_save_uaid
# 需要导入模块: from autopush.db import Router [as 别名]
# 或者: from autopush.db.Router import get_uaid [as 别名]
def test_save_uaid(self):
uaid = str(uuid.uuid4())
r = get_router_table()
router = Router(r, SinkMetrics())
result = router.register_user(dict(uaid=uaid, node_id="me", connected_at=1234))
eq_(result[0], True)
eq_(result[1], {"uaid": uaid, "connected_at": 1234, "node_id": "me"})
result = router.get_uaid(uaid)
eq_(bool(result), True)
eq_(result["node_id"], "me")
示例4: test_node_clear
# 需要导入模块: from autopush.db import Router [as 别名]
# 或者: from autopush.db.Router import get_uaid [as 别名]
def test_node_clear(self):
r = get_router_table()
router = Router(r, SinkMetrics())
# Register a node user
router.register_user(dict(uaid=dummy_uaid, node_id="asdf",
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")