예제 #1
0
 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)
예제 #2
0
 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))
예제 #3
0
 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']))
예제 #4
0
 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)
예제 #5
0
 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))
예제 #6
0
 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']))