def test_commit2(self): b = cas.Blob('test content') b2 = cas.Blob('deja vu') b3 = cas.Blob('jamais vu') yield self.cas.put(b) yield self.cas.put(b2) yield self.cas.put(b3) t1 = cas.Tree(cas.Element('test', sha1(b)), cas.Element('hello', sha1(b2))) t1id = yield self.cas.put(t1) t2 = cas.Tree(cas.Element('thing', sha1(b3)), cas.Element('tree', sha1(t1))) t2id = yield self.cas.put(t2) c = cas.Commit(t2id, log='first commit') cid = yield self.cas.put(c) c_out = yield self.cas.get(cid) b3new = cas.Blob('I remember, now!') b3newid = yield self.cas.put(b3new) t2new = cas.Tree(cas.Element('thing', sha1(b3new)), cas.Element('tree', sha1(t1))) t2newid = yield self.cas.put(t2new) cnew = cas.Commit(t2newid, parents=[cid], log='know what i knew but forgot') cnewid = yield self.cas.put(cnew) cnew_out = yield self.cas.get(cnewid) self.failUnlessEqual(cnew.value, cnew_out.value)
def test_tree(self): b = cas.Blob('test content') yield self.cas.put(b) t1 = cas.Tree(cas.Element('test', sha1(b))) t1id = yield self.cas.put(t1) t1_out = yield self.cas.get(t1id) self.failUnlessEqual(t1_out.value, t1.value)
def test_tree2(self): b = cas.Blob('test content') b2 = cas.Blob('deja vu') b3 = cas.Blob('jamais vu') bid = yield self.cas.put(b) b2id = yield self.cas.put(b2) b3id = yield self.cas.put(b3) t1 = cas.Tree(cas.Element('test', sha1(b)), cas.Element('hello', sha1(b2))) t1id = yield self.cas.put(t1) t2 = cas.Tree(cas.Element('thing', sha1(b3)), cas.Element('tree', sha1(t1))) t2id = yield self.cas.put(t2) t1_out = yield self.cas.get(t1id) self.failUnlessEqual(t1_out.value, t1.value) t2_out = yield self.cas.get(t2id) self.failUnlessEqual(t2_out.value, t2.value)
def test_commit(self): b = cas.Blob('test content') b2 = cas.Blob('deja vu') b3 = cas.Blob('jamais vu') yield self.cas.put(b) yield self.cas.put(b2) yield self.cas.put(b3) t1 = cas.Tree(cas.Element('test', sha1(b)), cas.Element('hello', sha1(b2))) t1id = yield self.cas.put(t1) t2 = cas.Tree(cas.Element('thing', sha1(b3)), cas.Element('tree', sha1(t1))) t2id = yield self.cas.put(t2) c = cas.Commit(t2id, log='first commit') cid = yield self.cas.put(c) c_out = yield self.cas.get(cid) self.failUnlessEqual(c.value, c_out.value)
def test_encode(self): b = cas.Blob('foo') self.failUnlessEqual(b.encode(), self.encoded)
def setUp(self): self.blob = cas.Blob('foo') self.encoded = "blob 3\x00foo"
def test_blob(self): c1 = 'test content' b = cas.Blob(c1) bid = yield self.cas.put(b) b_out = yield self.cas.get(bid) self.failUnlessEqual(sha1(b), sha1(b_out))
def test_get(self): b = cas.Blob('test') id = yield self.object_store.put(b) b_out = yield self.object_store.get(id) self.failUnlessEqual(b.encode(), b_out.encode())
def test_put(self): b = cas.Blob('test') id = yield self.object_store.put(b) self.failUnlessEqual(id, cas.sha1(b, bin=False))