|
@@ -250,6 +250,19 @@ class DiskObjectStoreTests(PackBasedObjectStoreTests, TestCase):
|
|
|
["/foo/path", "/bar/path"],
|
|
|
store._read_alternate_paths())
|
|
|
|
|
|
+ def test_rel_alternative_path(self):
|
|
|
+ alternate_dir = tempfile.mkdtemp()
|
|
|
+ self.addCleanup(shutil.rmtree, alternate_dir)
|
|
|
+ alternate_store = DiskObjectStore(alternate_dir)
|
|
|
+ b2 = make_object(Blob, data="yummy data")
|
|
|
+ alternate_store.add_object(b2)
|
|
|
+ store = DiskObjectStore(self.store_dir)
|
|
|
+ self.assertRaises(KeyError, store.__getitem__, b2.id)
|
|
|
+ store.add_alternate_path(os.path.relpath(alternate_dir, self.store_dir))
|
|
|
+ self.assertEqual(list(alternate_store), list(store.alternates[0]))
|
|
|
+ self.assertIn(b2.id, store)
|
|
|
+ self.assertEqual(b2, store[b2.id])
|
|
|
+
|
|
|
def test_pack_dir(self):
|
|
|
o = DiskObjectStore(self.store_dir)
|
|
|
self.assertEqual(os.path.join(self.store_dir, "pack"), o.pack_dir)
|