当前位置: 首页>>代码示例>>Python>>正文


Python Message.unregister_channel方法代码示例

本文整理汇总了Python中autopush.db.Message.unregister_channel方法的典型用法代码示例。如果您正苦于以下问题:Python Message.unregister_channel方法的具体用法?Python Message.unregister_channel怎么用?Python Message.unregister_channel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autopush.db.Message的用法示例。


在下文中一共展示了Message.unregister_channel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_unregister

# 需要导入模块: from autopush.db import Message [as 别名]
# 或者: from autopush.db.Message import unregister_channel [as 别名]
    def test_unregister(self):
        chid = str(uuid.uuid4())
        m = get_rotating_message_table()
        message = Message(m, SinkMetrics())
        message.register_channel(self.uaid, chid)

        # Verify its in the db
        rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
        results = list(rows)
        assert len(results) == 1
        eq_(results[0]["chids"], set([chid]))

        message.unregister_channel(self.uaid, chid)

        # Verify its not in the db
        rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
        results = list(rows)
        assert len(results) == 1
        eq_(results[0]["chids"], set([]))

        # Test for the very unlikely case that there's no 'chid'
        m.connection.update_item = Mock()
        m.connection.update_item.return_value = {"Attributes": {"uaid": {"S": self.uaid}}, "ConsumedCapacityUnits": 0.5}
        r = message.unregister_channel(self.uaid, "test")
        eq_(r, False)
开发者ID:lholmquist,项目名称:autopush,代码行数:27,代码来源:test_db.py

示例2: test_all_channels

# 需要导入模块: from autopush.db import Message [as 别名]
# 或者: from autopush.db.Message import unregister_channel [as 别名]
    def test_all_channels(self):
        chid = str(uuid.uuid4())
        chid2 = str(uuid.uuid4())
        m = get_rotating_message_table()
        message = Message(m, SinkMetrics())
        message.register_channel(self.uaid, chid)
        message.register_channel(self.uaid, chid2)

        _, chans = message.all_channels(self.uaid)
        assert chid in chans
        assert chid2 in chans

        message.unregister_channel(self.uaid, chid2)
        _, chans = message.all_channels(self.uaid)
        assert chid2 not in chans
        assert chid in chans
开发者ID:lholmquist,项目名称:autopush,代码行数:18,代码来源:test_db.py

示例3: test_unregister

# 需要导入模块: from autopush.db import Message [as 别名]
# 或者: from autopush.db.Message import unregister_channel [as 别名]
    def test_unregister(self):
        chid = str(uuid.uuid4())
        m = get_message_table()
        message = Message(m, SinkMetrics())
        message.register_channel(self.uaid, chid)

        # Verify its in the db
        rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
        results = list(rows)
        assert(len(results) == 1)
        eq_(results[0]["chids"], set([chid]))

        message.unregister_channel(self.uaid, chid)

        # Verify its not in the db
        rows = m.query_2(uaid__eq=self.uaid, chidmessageid__eq=" ")
        results = list(rows)
        assert(len(results) == 1)
        eq_(results[0]["chids"], set([]))
开发者ID:ncalexan,项目名称:autopush,代码行数:21,代码来源:test_db.py


注:本文中的autopush.db.Message.unregister_channel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。