Beispiel #1
0
 def test___iter__no_suffix(self):
     my_store = TextStore(MemoryTransport(),
                          prefixed=False,
                          compressed=False)
     stream = StringIO("content")
     my_store.add(stream, "foo")
     self.assertEqual(set(['foo']), set(my_store.__iter__()))
Beispiel #2
0
 def test___iter__no_suffix(self):
     my_store = TextStore(MemoryTransport(),
                          prefixed=False, compressed=False)
     stream = StringIO("content")
     my_store.add(stream, "foo")
     self.assertEqual(set(['foo']),
                      set(my_store.__iter__()))
Beispiel #3
0
 def test_copy_suffixes(self):
     from_store = self.get_populated_store()
     to_store = TextStore(MemoryTransport(), prefixed=True, compressed=True)
     to_store.register_suffix('sig')
     to_store.copy_all_ids(from_store)
     self.assertEqual(1, len(to_store))
     self.assertEqual(set(['foo']), set(to_store.__iter__()))
     self.assertEqual('content', to_store.get('foo').read())
     self.assertEqual('signature', to_store.get('foo', 'sig').read())
     self.assertRaises(KeyError, to_store.get, 'missing', 'sig')
Beispiel #4
0
 def test_copy_suffixes(self):
     from_store = self.get_populated_store()
     to_store = TextStore(MemoryTransport(), prefixed=True, compressed=True)
     to_store.register_suffix("sig")
     to_store.copy_all_ids(from_store)
     self.assertEqual(1, len(to_store))
     self.assertEqual(set(["foo"]), set(to_store.__iter__()))
     self.assertEqual("content", to_store.get("foo").read())
     self.assertEqual("signature", to_store.get("foo", "sig").read())
     self.assertRaises(KeyError, to_store.get, "missing", "sig")
Beispiel #5
0
 def test_copy_suffixes(self):
     from_store = self.get_populated_store()
     to_store = TextStore(MemoryTransport(),
                          prefixed=True, compressed=True)
     to_store.register_suffix('sig')
     to_store.copy_all_ids(from_store)
     self.assertEqual(1, len(to_store))
     self.assertEqual(set(['foo']), set(to_store.__iter__()))
     self.assertEqual('content', to_store.get('foo').read())
     self.assertEqual('signature', to_store.get('foo', 'sig').read())
     self.assertRaises(KeyError, to_store.get, 'missing', 'sig')
Beispiel #6
0
 def get_store(name, compressed=True, prefixed=False):
     # FIXME: This approach of assuming stores are all entirely compressed
     # or entirely uncompressed is tidy, but breaks upgrade from
     # some existing branches where there's a mixture; we probably
     # still want the option to look for both.
     relpath = a_bzrdir._control_files._escape(name)
     store = TextStore(a_bzrdir.transport.clone(relpath),
                       prefixed=prefixed,
                       compressed=compressed,
                       dir_mode=dir_mode,
                       file_mode=file_mode)
     return store
Beispiel #7
0
 def test__relpath_suffixed(self):
     my_store = TextStore(MockTransport(), prefixed=True, compressed=True)
     my_store.register_suffix("dsc")
     self.assertEqual("45/foo.dsc", my_store._relpath("foo", ["dsc"]))
Beispiel #8
0
 def get_store(self):
     return TextStore(MemoryTransport())
Beispiel #9
0
 def test__relpath_suffixed(self):
     my_store = TextStore(MockTransport(), prefixed=True, compressed=True)
     my_store.register_suffix('dsc')
     self.assertEqual('45/foo.dsc', my_store._relpath('foo', ['dsc']))
Beispiel #10
0
 def get_store(self, path=u'.'):
     t = transport.get_transport(path)
     return TextStore(t, compressed=True)
 def get_store(self, path=u'.', compressed=True):
     t = transport.get_transport_from_path(path)
     return TextStore(t, compressed=compressed)
Beispiel #12
0
 def test__relpath_suffixed(self):
     my_store = TextStore(MockTransport(),
                          prefixed=True, compressed=True)
     my_store.register_suffix('dsc')
     self.assertEqual('45/foo.dsc', my_store._relpath('foo', ['dsc']))