X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/777e716728a7da63ece00df7e5bb8be7f9a2a1a3..03188ad6eb14ee3dcd6bdf74198624c9358936c5:/sdk/python/tests/test_arv_get.py diff --git a/sdk/python/tests/test_arv_get.py b/sdk/python/tests/test_arv_get.py index 907c671822..4feac0fd61 100644 --- a/sdk/python/tests/test_arv_get.py +++ b/sdk/python/tests/test_arv_get.py @@ -26,6 +26,7 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers): shutil.rmtree(self.tempdir) def write_test_collection(self, + strip_manifest=False, contents = { 'foo.txt' : 'foo', 'bar.txt' : 'bar', @@ -36,7 +37,9 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers): with c.open(path, 'w') as f: f.write(data) c.save_new() - return (c.manifest_locator(), c.portable_data_hash(), c.manifest_text()) + return (c.manifest_locator(), + c.portable_data_hash(), + c.manifest_text(strip=strip_manifest)) def run_get(self, args): self.stdout = io.BytesIO() @@ -73,12 +76,30 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers): with open("{}/subdir/baz.txt".format(self.tempdir), "r") as f: self.assertEqual("baz", f.read()) - def test_get_collection_manifest(self): - # Get the collection manifest + def test_get_collection_unstripped_manifest(self): + # Get the collection manifest by UUID r = self.run_get([self.col_loc, self.tempdir]) self.assertEqual(0, r) with open("{}/{}".format(self.tempdir, self.col_loc), "r") as f: self.assertEqual(self.col_manifest, f.read()) + # Get the collection manifest by PDH + r = self.run_get([self.col_pdh, self.tempdir]) + self.assertEqual(0, r) + with open("{}/{}".format(self.tempdir, self.col_pdh), "r") as f: + self.assertEqual(self.col_manifest, f.read()) + + def test_get_collection_stripped_manifest(self): + col_loc, col_pdh, col_manifest = self.write_test_collection(strip_manifest=True) + # Get the collection manifest by UUID + r = self.run_get(['--strip-manifest', col_loc, self.tempdir]) + self.assertEqual(0, r) + with open("{}/{}".format(self.tempdir, col_loc), "r") as f: + self.assertEqual(col_manifest, f.read()) + # Get the collection manifest by PDH + r = self.run_get(['--strip-manifest', col_pdh, self.tempdir]) + self.assertEqual(0, r) + with open("{}/{}".format(self.tempdir, col_pdh), "r") as f: + self.assertEqual(col_manifest, f.read()) def test_invalid_collection(self): # Asking for an invalid collection should generate an error.