def test_get_group_existing_cached(self):
        group = Group('testgroup')
        group.coordinator = self.client.cluster.brokers[1]
        group._last_updated = time.time()
        self.client.cluster.add_group(group)

        self.client._send_group_aware_request = MagicMock()
        self.client._send_group_aware_request.return_value = self.describe_groups
        self.client._update_groups_from_describe = MagicMock()
        val = self.client.get_group('testgroup')

        self.client._send_group_aware_request.assert_not_called()
        self.client._update_groups_from_describe.assert_not_called()

        assert isinstance(val, Group)
        assert val.name == 'testgroup'
        assert val.coordinator == self.client.cluster.brokers[1]
Пример #2
0
 def test_updated_since(self):
     group = Group('testgroup')
     group._last_updated = 100
     assert group.updated_since(99)
Пример #3
0
 def test_updated_since(self):
     group = Group('testgroup')
     group._last_updated = 100
     assert group.updated_since(99)