test getters, fix chunk_size
This commit is contained in:
parent
0d4f6acde1
commit
c95f9823b0
@ -139,7 +139,7 @@ class GridFile(object):
|
||||
name = __create_property("filename")
|
||||
content_type = __create_property("contentType")
|
||||
length = __create_property("length", True)
|
||||
chunk_size = __create_property("filename", True)
|
||||
chunk_size = __create_property("chunkSize", True)
|
||||
upload_date = __create_property("uploadDate", True)
|
||||
aliases = __create_property("aliases")
|
||||
next = __create_property("next", True)
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import qcheck
|
||||
from test_connection import get_connection
|
||||
@ -54,6 +55,7 @@ class TestGridFile(unittest.TestCase):
|
||||
self.assertEqual(self.db._chunks.find().count(), 0)
|
||||
|
||||
file = GridFile({"filename": "test"}, self.db)
|
||||
self.assertEqual(file.next, None)
|
||||
self.assertEqual(file.read(), "")
|
||||
file.close()
|
||||
|
||||
@ -89,7 +91,15 @@ class TestGridFile(unittest.TestCase):
|
||||
self.assertRaises(TypeError, GridFile, {}, self.db, "r", [])
|
||||
|
||||
self.assertRaises(IOError, GridFile, {"filename": "mike"}, self.db)
|
||||
self.assertTrue(GridFile({"filename": "test"}, self.db))
|
||||
|
||||
a = GridFile({"filename": "test"}, self.db)
|
||||
self.assertEqual(a.length, 0)
|
||||
self.assertEqual(a.content_type, None)
|
||||
self.assertEqual(a.name, "test")
|
||||
self.assertEqual(a.chunk_size, 256000)
|
||||
self.assertTrue(isinstance(a.upload_date, datetime.datetime))
|
||||
self.assertEqual(a.aliases, None)
|
||||
self.assertEqual(a.next, None)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user