def test_get_helped(self): responses.add(responses.GET, 'http://localhost:8085/trustchain/statistics', json={'statistics': { 'peers_that_pk_helped': 400 }}) self.assertEquals(Tribler.get_helped(), 400)
def test_get_helped_error(self): self.requests = requests.get requests.get = MagicMock(side_effect=requests.ConnectionError) self.assertEquals( Tribler.get_helped(), "Unable to retrieve amount of peers helped by this agent") requests.get = self.requests
def msg_helped(self): self.send_msg("I currently have helped: %s peers" % tribler_controller.get_helped())