示例#1
0
    def test_save_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)

        exists, chans = message.all_channels(self.uaid)
        new_uaid = uuid.uuid4().hex
        message.save_channels(new_uaid, chans)
        _, new_chans = message.all_channels(new_uaid)
        eq_(chans, new_chans)
示例#2
0
    def test_save_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)

        exists, chans = message.all_channels(self.uaid)
        new_uaid = uuid.uuid4().hex
        message.save_channels(new_uaid, chans)
        _, new_chans = message.all_channels(new_uaid)
        eq_(chans, new_chans)
示例#3
0
    def test_save_channels(self):
        chid = str(uuid.uuid4())
        chid2 = str(uuid.uuid4())
        m = get_rotating_message_tablename(boto_resource=self.resource)
        message = Message(m, boto_resource=self.resource)
        message.register_channel(self.uaid, chid)
        message.register_channel(self.uaid, chid2)

        exists, chans = message.all_channels(self.uaid)
        new_uaid = uuid.uuid4().hex
        message.save_channels(new_uaid, chans)
        _, new_chans = message.all_channels(new_uaid)
        assert chans == new_chans
示例#4
0
    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
示例#5
0
    def test_all_channels(self):
        chid = str(uuid.uuid4())
        chid2 = str(uuid.uuid4())
        m = get_rotating_message_tablename(boto_resource=self.resource)
        message = Message(m, boto_resource=self.resource)
        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
示例#6
0
    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)
示例#7
0
文件: test_db.py 项目: jk128/autopush
    def test_all_channels_fail(self):
        m = get_rotating_message_table()
        message = Message(m, SinkMetrics())

        message.table.get_item = Mock()
        message.table.get_item.return_value = {
            "ResponseMetadata": {
                "HTTPStatusCode": 400
            },
        }

        res = message.all_channels(self.uaid)
        assert res == (False, set([]))
示例#8
0
    def test_all_channels_fail(self):

        m = get_rotating_message_tablename(boto_resource=self.resource)
        message = Message(m, boto_resource=self.resource)

        mtable = Mock()
        mtable.get_item.return_value = {
            "ResponseMetadata": {
                "HTTPStatusCode": 400
            },
        }
        message.table = mtable
        res = message.all_channels(self.uaid)
        assert res == (False, set([]))
示例#9
0
 def test_all_channels_no_uaid(self):
     m = get_rotating_message_table()
     message = Message(m, SinkMetrics())
     exists, chans = message.all_channels("asdf")
     assert chans == set([])
示例#10
0
 def test_all_channels_no_uaid(self):
     m = get_rotating_message_tablename(boto_resource=self.resource)
     message = Message(m, boto_resource=self.resource)
     exists, chans = message.all_channels(dummy_uaid)
     assert chans == set([])
示例#11
0
 def test_all_channels_no_uaid(self):
     m = get_rotating_message_table()
     message = Message(m, SinkMetrics())
     exists, chans = message.all_channels(dummy_uaid)
     assert (chans == set([]))
示例#12
0
 def test_all_channels_no_uaid(self):
     m = get_message_table()
     message = Message(m, SinkMetrics())
     assert(message.all_channels("asdf") == set([]))
示例#13
0
 def test_all_channels_no_uaid(self):
     m = get_message_table()
     message = Message(m, SinkMetrics())
     assert (message.all_channels("asdf") == set([]))