Example #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")
    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')
Example #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')
    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)
Example #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)
Example #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))
    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))
Example #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')
Example #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)
Example #10
0
    def test_base_channel_id(self):
        channel = BaseChannel(100)

        self.assertEqual(channel.channel_id, 100)
Example #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)
Example #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')
Example #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")