示例#1
0
 def test___iter__escaped(self):
     self.vfstore = VersionedFileStore(MemoryTransport(),
         prefixed=True, escaped=True, versionedfile_class=WeaveFile)
     self.vfstore.get_scope = self.get_scope
     self._transaction = transactions.WriteTransaction()
     vf = self.vfstore.get_weave_or_empty(' ', self._transaction)
     vf.add_lines('a', [], [])
     del vf
     self._transaction.finish()
     self.assertEqual([' '], list(self.vfstore))
示例#2
0
 def test___iter__escaped(self):
     self.vfstore = VersionedFileStore(MemoryTransport(), prefixed=True, escaped=True, versionedfile_class=WeaveFile)
     self.vfstore.get_scope = self.get_scope
     self._transaction = transactions.WriteTransaction()
     vf = self.vfstore.get_weave_or_empty(" ", self._transaction)
     vf.add_lines("a", [], [])
     del vf
     self._transaction.finish()
     self.assertEqual([" "], list(self.vfstore))
示例#3
0
class TestVersionFileStore(TestCaseWithTransport):

    def get_scope(self):
        return self._transaction

    def setUp(self):
        super(TestVersionFileStore, self).setUp()
        self.vfstore = VersionedFileStore(MemoryTransport(),
            versionedfile_class=WeaveFile)
        self.vfstore.get_scope = self.get_scope
        self._transaction = None

    def test_get_weave_registers_dirty_in_write(self):
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
        self._transaction.finish()
        self._transaction = None
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave('id', self._transaction)
        self._transaction.finish()
        self._transaction = None
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])

    def test_get_weave_readonly_cant_write(self):
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
        self._transaction.finish()
        self._transaction = transactions.ReadOnlyTransaction()
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'b', [], [])

    def test___iter__escaped(self):
        self.vfstore = VersionedFileStore(MemoryTransport(),
            prefixed=True, escaped=True, versionedfile_class=WeaveFile)
        self.vfstore.get_scope = self.get_scope
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty(' ', self._transaction)
        vf.add_lines('a', [], [])
        del vf
        self._transaction.finish()
        self.assertEqual([' '], list(self.vfstore))
示例#4
0
class TestVersionFileStore(TestCaseWithTransport):
    def get_scope(self):
        return self._transaction

    def setUp(self):
        super(TestVersionFileStore, self).setUp()
        self.vfstore = VersionedFileStore(MemoryTransport(), versionedfile_class=WeaveFile)
        self.vfstore.get_scope = self.get_scope
        self._transaction = None

    def test_get_weave_registers_dirty_in_write(self):
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty("id", self._transaction)
        self._transaction.finish()
        self._transaction = None
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, "b", [], [])
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave("id", self._transaction)
        self._transaction.finish()
        self._transaction = None
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, "b", [], [])

    def test_get_weave_readonly_cant_write(self):
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty("id", self._transaction)
        self._transaction.finish()
        self._transaction = transactions.ReadOnlyTransaction()
        vf = self.vfstore.get_weave_or_empty("id", self._transaction)
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, "b", [], [])

    def test___iter__escaped(self):
        self.vfstore = VersionedFileStore(MemoryTransport(), prefixed=True, escaped=True, versionedfile_class=WeaveFile)
        self.vfstore.get_scope = self.get_scope
        self._transaction = transactions.WriteTransaction()
        vf = self.vfstore.get_weave_or_empty(" ", self._transaction)
        vf.add_lines("a", [], [])
        del vf
        self._transaction.finish()
        self.assertEqual([" "], list(self.vfstore))
示例#5
0
 def setUp(self):
     super(TestVersionFileStore, self).setUp()
     self.vfstore = VersionedFileStore(MemoryTransport(), versionedfile_class=WeaveFile)
     self.vfstore.get_scope = self.get_scope
     self._transaction = None
示例#6
0
 def setUp(self):
     super(TestVersionFileStore, self).setUp()
     self.vfstore = VersionedFileStore(MemoryTransport(),
         versionedfile_class=WeaveFile)
     self.vfstore.get_scope = self.get_scope
     self._transaction = None