def test_no_data_returned(self, http): http.return_value = StringIO('null') with self.assertRaises(RuntimeError) as ctx: _get_json_for_cap({'node-url': 'http://localhost:1234'}, 'fake cap') self.assertTrue('No data from' in str(ctx.exception))
def test_happy_path_for_cap(self, http): http.return_value = StringIO('{"some": "json"}') resp = _get_json_for_cap({'node-url': 'http://localhost:1234'}, 'fake cap') self.assertEqual(resp, dict(some='json'))
def test_no_data_returned(self, http): http.return_value = StringIO('null') with self.assertRaises(RuntimeError) as ctx: _get_json_for_cap({'node-url': 'http://localhost:1234'}, 'fake cap') self.assertTrue('No data from' in str(ctx.exception))
def test_happy_path_for_cap(self, http): http.return_value = StringIO('{"some": "json"}') resp = _get_json_for_cap({'node-url': 'http://localhost:1234'}, 'fake cap') self.assertEqual(resp, dict(some='json'))