Esempio n. 1
0
    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))
Esempio n. 2
0
 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'))
Esempio n. 3
0
    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))
Esempio n. 4
0
 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'))