示例#1
0
 def test_update_simple(self):
     """Update a kilink with new content."""
     parent_content = "some content"
     child_content = "some content"
     kid = self.bkend.create_kilink(parent_content)
     new_revno = self.bkend.update_kilink(kid, 1, child_content)
     self.assertEqual(new_revno, 2)
     parent = Kilink.selectBy(kid=kid, revno=1).getOne()
     self.assertEqual(parent.content, zlib.compress(parent_content))
     child = Kilink.selectBy(kid=kid, revno=2).getOne()
     self.assertEqual(child.content, zlib.compress(child_content))
示例#2
0
 def test_create_simple(self):
     """Simple create."""
     content = "some content"
     zipped = zlib.compress(content)
     kid = self.bkend.create_kilink(content)
     klnk = Kilink.selectBy(kid=kid).getOne()
     self.assertEqual(klnk.content, zipped)
     self.assertEqual(klnk.revno, 1)
     self.assertEqual(klnk.parent_revno, None)
示例#3
0
 def test_update_bad_revno(self):
     """No revno to create a child."""
     kid = self.bkend.create_kilink("content")
     klnk = Kilink.selectBy(kid=kid).getOne()
     assert klnk.revno != 37
     self.assertRaises(ValueError, self.bkend.update_kilink, kid, 37, "content")
示例#4
0
 def test_create_kid_ok(self):
     """Create indicating a new kid."""
     self.bkend.create_kilink("some content", kid="kid")
     self.assertEqual(Kilink.selectBy(kid="kid").count(), 1)
示例#5
0
 def tearDown(self):
     """Tear down."""
     Kilink.dropTable()
示例#6
0
 def setUp(self):
     """Set up."""
     super(BaseTestCase, self).setUp()
     self.bkend = KilinkBackend("sqlite:/:memory:?debug=0")
     Kilink.createTable()