def test_max_fetch_size_okay(self, mock_get): url = 'http://example.com/plan' data = '{ "foo": "bar" }' mock_get.return_value = Response(data) urlfetch.get(url, FETCH_SIZE_OK)
def test_https_scheme(self, mock_get): url = 'https://example.com/plan' data = '{ "foo": "bar" }' mock_get.return_value = Response(data) self.assertEqual(data, urlfetch.get(url, FETCH_SIZE_OK))
def test_file_scheme_supported(self, mock_urlopen): data = '{ "foo": "bar" }' url = 'file:///etc/profile' mock_urlopen.return_value = moves.cStringIO(data) self.assertEqual( data, urlfetch.get(url, FETCH_SIZE_OK, allowed_schemes=['file']))
def test_file_scheme_supported(self, mock_urlopen): data = '{ "foo": "bar" }' url = 'file:///etc/profile' mock_urlopen.return_value = moves.cStringIO(data) self.assertEqual(data, urlfetch.get(url, FETCH_SIZE_OK, allowed_schemes=['file']))