def test_get_stats(self): ep = ListeningBaseEndpoint() ep._chan = Mock(spec=ListenChannel) ep.get_stats() ep._chan.get_stats.assert_called_once_with()
def test_get_stats_multiple_on_named_queue(self): ep1 = ListeningBaseEndpoint(node=self.container.node, from_name="test_get_stats_multi") gl1 = spawn(ep1.listen) ep2 = ListeningBaseEndpoint(node=self.container.node, from_name="test_get_stats_multi") gl2 = spawn(ep2.listen) ep1.get_ready_event().wait(timeout=5) ep2.get_ready_event().wait(timeout=5) gs_res1 = ep1.get_stats() self.assertEquals(gs_res1, (0, 2)) # num of messages, num listeners gs_res2 = ep2.get_stats() self.assertEquals(gs_res2, (0, 2)) # num of messages, num listeners ep1.close() ep2.close() gl1.join(timeout=5) gl2.join(timeout=5)
def test_get_stats(self): ep = ListeningBaseEndpoint(node=self.container.node) gl = spawn(ep.listen, binding="test_get_stats") ep.get_ready_event().wait(timeout=5) gs_res = ep.get_stats() self.assertEquals(gs_res, (0, 1)) # num of messages, num listeners ep.close() gl.join(timeout=5)