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'))
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())
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())
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'))