Beispiel #1
0
 def test_urlopen_with_auth_exists(self):
     req = md5s3stash.urlopen_with_auth(self.testfilepath)
     req = md5s3stash.urlopen_with_auth(self.testfilepath, auth=None)
     url_http = 'http://example.edu'
     self.assertRaises(URLError,
                       md5s3stash.urlopen_with_auth,
                       url_http,
                       auth=('user', 'password'))
Beispiel #2
0
 def test_urlopen_with_auth(self, mock_urlopen, mock_bo={}):
     test_str = 'test resp'
     mock_urlopen.return_value = StringIO(test_str)
     self.urlopen_mock.return_value = MockResponse(test_str)
     # self.urlopen_mock.return_value = StringIO(test_str)
     url_http = 'https://example.edu'
     f = md5s3stash.urlopen_with_auth(url_http,
                                      auth=('user','password'),
                                      cache={},)
     self.assertEqual(test_str, f.read())
Beispiel #3
0
 def test_urlopen_with_auth(self, mock_urlopen, mock_bo={}):
     test_str = 'test resp'
     mock_urlopen.return_value = StringIO(test_str)
     self.urlopen_mock.return_value = MockResponse(test_str)
     # self.urlopen_mock.return_value = StringIO(test_str)
     url_http = 'https://example.edu'
     f = md5s3stash.urlopen_with_auth(
         url_http,
         auth=('user', 'password'),
         cache={},
     )
     self.assertEqual(test_str, f.read())
Beispiel #4
0
 def test_urlopen_with_auth_exists(self):
     req = md5s3stash.urlopen_with_auth(self.testfilepath)
     req = md5s3stash.urlopen_with_auth(self.testfilepath, auth=None)
     url_http = 'http://example.edu'
     self.assertRaises(URLError, md5s3stash.urlopen_with_auth, url_http,
                                         auth=('user','password'))