Exemplo n.º 1
0
 def test_remove_single_consumer_tag(self):
     channel = BaseChannel(0)
     channel.add_consumer_tag("1")
     channel.add_consumer_tag("2")
     channel.remove_consumer_tag("1")
     self.assertEqual(len(channel.consumer_tags), 1)
     self.assertEqual(channel.consumer_tags[0], "2")
Exemplo n.º 2
0
    def test_base_channel_add_duplicate_consumer_tags(self):
        channel = BaseChannel(0)

        channel.add_consumer_tag('travis-ci')
        channel.add_consumer_tag('travis-ci')

        self.assertEqual(len(channel.consumer_tags), 1)
        self.assertEqual(channel.consumer_tags[0], 'travis-ci')
Exemplo n.º 3
0
    def test_base_channel_add_duplicate_consumer_tags(self):
        channel = BaseChannel(0)

        channel.add_consumer_tag('travis-ci')
        channel.add_consumer_tag('travis-ci')

        self.assertEqual(len(channel.consumer_tags), 1)
        self.assertEqual(channel.consumer_tags[0], 'travis-ci')
Exemplo n.º 4
0
    def test_base_channel_remove_all_consumer_tags(self):
        channel = BaseChannel(0)

        self.assertEqual(len(channel.consumer_tags), 0)

        for _ in range(100):
            channel.add_consumer_tag('travis-ci')
        channel.remove_consumer_tag(None)

        self.assertEqual(len(channel.consumer_tags), 0)
Exemplo n.º 5
0
 def test_base_channel_remove_all_consumer_tags(self):
     channel = BaseChannel(0)
     channel.add_consumer_tag('my_tag')
     channel.add_consumer_tag('my_tag')
     channel.add_consumer_tag('my_tag')
     channel.remove_consumer_tag()
     self.assertEqual(len(channel.consumer_tags), 0)
Exemplo n.º 6
0
    def test_base_channel_remove_empty_string(self):
        channel = BaseChannel(0)
        channel.add_consumer_tag('travis-ci')
        channel.add_consumer_tag('')

        channel.remove_consumer_tag('')

        self.assertTrue(len(channel.consumer_tags))
Exemplo n.º 7
0
    def test_base_channel_remove_empty_string(self):
        channel = BaseChannel(0)
        channel.add_consumer_tag('travis-ci')
        channel.add_consumer_tag('')

        channel.remove_consumer_tag('')

        self.assertTrue(len(channel.consumer_tags))
Exemplo n.º 8
0
 def test_base_channel_remove_single_consumer_tag(self):
     channel = BaseChannel(0)
     channel.add_consumer_tag('1')
     channel.add_consumer_tag('2')
     channel.remove_consumer_tag('1')
     self.assertEqual(len(channel.consumer_tags), 1)
     self.assertEqual(channel.consumer_tags[0], '2')
Exemplo n.º 9
0
    def test_base_channel_remove_all_consumer_tags(self):
        channel = BaseChannel(0)

        self.assertEqual(len(channel.consumer_tags), 0)

        for _ in range(100):
            channel.add_consumer_tag('travis-ci')
        channel.remove_consumer_tag(None)

        self.assertEqual(len(channel.consumer_tags), 0)
Exemplo n.º 10
0
    def test_base_channel_id(self):
        channel = BaseChannel(100)

        self.assertEqual(channel.channel_id, 100)
Exemplo n.º 11
0
 def test_base_channel_add_consumer_tag_none_raises(self):
     channel = BaseChannel(0)
     self.assertRaisesRegexp(AMQPChannelError,
                             'consumer tag needs to be a string',
                             channel.add_consumer_tag, None)
     self.assertFalse(channel.consumer_tags)
Exemplo n.º 12
0
 def test_base_channel_add_consumer_tag(self):
     channel = BaseChannel(0)
     channel.add_consumer_tag('my_tag')
     self.assertEqual(channel.consumer_tags[0], 'my_tag')
Exemplo n.º 13
0
 def test_add_consumer_tag(self):
     channel = BaseChannel(0)
     channel.add_consumer_tag("my_tag")
     self.assertEqual(channel.consumer_tags[0], "my_tag")