import io
import os
+import re
import shutil
import tempfile
self.assertEqual("baz", f.read())
def test_get_collection_unstripped_manifest(self):
+ dummy_token = "+Axxxxxxx"
# Get the collection manifest by UUID
r = self.run_get([self.col_loc, self.tempdir])
self.assertEqual(0, r)
- m_from_collection = collection.Collection(self.col_manifest).manifest_text(strip=True)
+ m_from_collection = re.sub(r"\+A[0-9a-f@]+", dummy_token, self.col_manifest)
with open(os.path.join(self.tempdir, self.col_loc), "r") as f:
- # Strip manifest before comparison to avoid races
- m_from_file = collection.Collection(f.read()).manifest_text(strip=True)
+ # Replace manifest tokens before comparison to avoid races
+ m_from_file = re.sub(r"\+A[0-9a-f@]+", dummy_token, f.read())
self.assertEqual(m_from_collection, m_from_file)
# Get the collection manifest by PDH
r = self.run_get([self.col_pdh, self.tempdir])
self.assertEqual(0, r)
with open(os.path.join(self.tempdir, self.col_pdh), "r") as f:
- # Strip manifest before comparison to avoid races
- m_from_file = collection.Collection(f.read()).manifest_text(strip=True)
+ # Replace manifest tokens before comparison to avoid races
+ m_from_file = re.sub(r"\+A[0-9a-f@]+", dummy_token, f.read())
self.assertEqual(m_from_collection, m_from_file)
def test_get_collection_stripped_manifest(self):