Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/units/db/blobs.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2014-04-27 14:52:25 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2014-04-27 14:52:25 (GMT)
commit2dbc9b554f322ea23b224d923d9a6475e33ad6e9 (patch)
tree55df42ddf7a0ec8d4ca6ef007218b1056409dc0b /tests/units/db/blobs.py
parent046073b04229021ec53833a353ffd069d0a5b561 (diff)
Implementation polishing
* http.request does not load posting stream before sending; * one-sigment packets; * move node related code to node module; * Principal capabilities; * batch posting while pushing client offline updates.
Diffstat (limited to 'tests/units/db/blobs.py')
-rwxr-xr-xtests/units/db/blobs.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/units/db/blobs.py b/tests/units/db/blobs.py
index 9672b39..35ebb62 100755
--- a/tests/units/db/blobs.py
+++ b/tests/units/db/blobs.py
@@ -129,6 +129,18 @@ class BlobsTest(tests.Test):
assert the_same_blob.digest == blob.digest
assert the_same_blob.path == blob.path
+ def test_post_File(self):
+ blobs = Blobs('.', Seqno())
+
+ self.touch(('blob', 'value'))
+ blob = blobs.post(File('blob', 'digest', {'foo': 'bar'}))
+
+ self.assertEqual('digest', blob.digest)
+ self.assertEqual(abspath('blobs/dig/digest'), blob.path)
+ self.assertEqual({'x-seqno': '1', 'foo': 'bar'}, blob.meta)
+ self.assertEqual('value', file(blob.path).read())
+ self.assertEqual(['x-seqno: 1', 'foo: bar'], file(blob.path + '.meta').read().strip().split('\n'))
+
def test_update(self):
blobs = Blobs('.', Seqno())
@@ -392,6 +404,17 @@ class BlobsTest(tests.Test):
assert not exists(blob.path)
self.assertEqual({'x-seqno': '-3', 'n': '1', 'status': '410 Gone'}, blob.meta)
+ def test_walk_Blobs(self):
+ blobs = Blobs('.', Seqno())
+
+ blob1 = blobs.post('1')
+ blob2 = blobs.post('2')
+ blob3 = blobs.post('3')
+
+ self.assertEqual(
+ sorted([blob1.digest, blob2.digest, blob3.digest]),
+ sorted([i.digest for i in blobs.walk()]))
+
class Seqno(object):