diff options
Diffstat (limited to 'tests/units/db')
-rwxr-xr-x | tests/units/db/blobs.py | 7 | ||||
-rwxr-xr-x | tests/units/db/routes.py | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/units/db/blobs.py b/tests/units/db/blobs.py index 463af56..9a68402 100755 --- a/tests/units/db/blobs.py +++ b/tests/units/db/blobs.py @@ -34,6 +34,7 @@ class BlobsTest(tests.Test): blob.path) self.assertEqual({ 'content-type': 'application/octet-stream', + 'content-length': str(len(content)), }, blob) @@ -42,6 +43,7 @@ class BlobsTest(tests.Test): file(blob.path).read()) self.assertEqual([ 'content-type: application/octet-stream', + 'content-length: %s' % len(content), ], file(blob.path + '.meta').read().strip().split('\n')) @@ -63,6 +65,7 @@ class BlobsTest(tests.Test): blob.path) self.assertEqual({ 'content-type': 'application/octet-stream', + 'content-length': str(len(content)), }, blob) @@ -71,6 +74,7 @@ class BlobsTest(tests.Test): file(blob.path).read()) self.assertEqual([ 'content-type: application/octet-stream', + 'content-length: %s' % len(content), ], file(blob.path + '.meta').read().strip().split('\n')) @@ -95,6 +99,7 @@ class BlobsTest(tests.Test): 'status': '301 Moved Permanently', 'location': 'location', 'content-type': 'application/octet-stream', + 'content-length': '0', }, blob) @@ -105,6 +110,7 @@ class BlobsTest(tests.Test): 'status: 301 Moved Permanently', 'location: location', 'content-type: application/octet-stream', + 'content-length: 0', ], file(blob.path + '.meta').read().strip().split('\n')) @@ -118,6 +124,7 @@ class BlobsTest(tests.Test): blob = blobs.post('probe') self.assertEqual({ 'content-type': 'application/octet-stream', + 'content-length': str(len('probe')), }, blob) diff --git a/tests/units/db/routes.py b/tests/units/db/routes.py index 5786760..24499d4 100755 --- a/tests/units/db/routes.py +++ b/tests/units/db/routes.py @@ -460,6 +460,15 @@ class RoutesTest(tests.Test): self.assertEqual('200 OK', response[0]) self.assertEqual('foo', dict(response[1]).get('content-type')) + this.call(method='PUT', path=['testdocument', guid], content={'blob': 'blob2'}, content_type='bar') + response = [] + [i for i in router({ + 'REQUEST_METHOD': 'GET', + 'PATH_INFO': '/testdocument/%s/blob' % guid, + }, lambda status, headers: response.extend([status, headers]))] + self.assertEqual('200 OK', response[0]) + self.assertEqual('default', dict(response[1]).get('content-type')) + def test_GetBLOBs(self): class TestDocument(db.Resource): |