| @@ -38,7 +38,7 @@ import urllib.request | |||||
| from importlib.abc import MetaPathFinder, Loader | from importlib.abc import MetaPathFinder, Loader | ||||
| from importlib.machinery import ModuleSpec | from importlib.machinery import ModuleSpec | ||||
| def _printanyexc(f): | |||||
| def _printanyexc(f): # pragma: no cover | |||||
| '''Prints any exception that gets raised by the wrapped function.''' | '''Prints any exception that gets raised by the wrapped function.''' | ||||
| @functools.wraps(f) | @functools.wraps(f) | ||||
| @@ -582,8 +582,16 @@ class Test(unittest.TestCase): | |||||
| self.assertEqual(data, ipfsdata) | self.assertEqual(data, ipfsdata) | ||||
| with self.assertRaises(ValueError): | with self.assertRaises(ValueError): | ||||
| # that a hash url fails | |||||
| ipfs.fetch_data(urllib.parse.urlparse('hash://sha256/asldfkj')) | ipfs.fetch_data(urllib.parse.urlparse('hash://sha256/asldfkj')) | ||||
| # that when the request fails | |||||
| uomock.return_value.__enter__.return_value.status = 400 | |||||
| # it raises a RuntimeError | |||||
| with self.assertRaises(RuntimeError): | |||||
| ipfs.fetch_data(hashurl) | |||||
| def test_overlappingaliases(self): | def test_overlappingaliases(self): | ||||
| # make sure that an aliases file is consistent and does not | # make sure that an aliases file is consistent and does not | ||||
| # override other urls. That is that any hashes are | # override other urls. That is that any hashes are | ||||