def test_ping(self, requests): requests.get = Mock(return_value=self.get_mock_response({})) client = SkyClient() ping = client.ping() requests.get.assert_called_once_with( 'http://127.0.0.1:8585/ping', headers={'content-type': 'application/json'}, data=None ) self.assertTrue(ping)
def test_failed_ping(self, requests): requests.get = Mock(side_effect=Exception('')) client = SkyClient() ping = client.ping() self.assertFalse(ping)