예제 #1
0
 def test_store_dict_big(self):
     content = self._get_big_dict()
     dictionary = {'content': content}
     self.assertGreater(len(json.dumps(dictionary, cls=MongoJSONEncoder)), 1000000)
     store_dict(dictionary, {})
     self.assertIsNone(dictionary['content'])
     self.assertEqual(content, fetch_dict(dictionary))
     self.assertLess(len(json.dumps(dictionary, cls=MongoJSONEncoder)), 100)
예제 #2
0
    def test_small_after_big(self):
        updates = {"content": self._get_big_dict()}
        store_dict(updates, {})
        file_id = updates[FILE_ID]
        self.assertIsNotNone(self.app.storage.get(file_id))

        original = updates
        updates = {"content": {"foo": 1}}
        store_dict(updates, original)

        self.assertIsNone(updates[FILE_ID])
        self.assertEqual(json.dumps({"foo": 1}), updates["content"])
        self.assertIsNone(self.app.storage.get(file_id))
예제 #3
0
    def test_small_after_big(self):
        updates = {'content': self._get_big_dict()}
        store_dict(updates, {})
        file_id = updates[FILE_ID]
        self.assertIsNotNone(self.app.storage.get(file_id))

        original = updates
        updates = {'content': {'foo': 1}}
        store_dict(updates, original)

        self.assertIsNone(updates[FILE_ID])
        self.assertEqual(json.dumps({'foo': 1}), updates['content'])
        self.assertIsNone(self.app.storage.get(file_id))
예제 #4
0
 def test_store_big_after_small(self):
     original = {"content": {"foo": 1}}
     updates = {"content": self._get_big_dict()}
     store_dict(updates, original)
     self.assertIsNone(updates["content"])
     self.assertIsNotNone(updates[FILE_ID])
예제 #5
0
 def test_store_dict_small(self):
     content = {"foo": 1}
     dictionary = {"content": content}
     store_dict(dictionary, {})
     self.assertEqual(json.dumps(content), dictionary.get("content"))
     self.assertEqual(content, fetch_dict(dictionary))
예제 #6
0
 def test_store_big_after_small(self):
     original = {'content': {'foo': 1}}
     updates = {'content': self._get_big_dict()}
     store_dict(updates, original)
     self.assertIsNone(updates['content'])
     self.assertIsNotNone(updates[FILE_ID])
예제 #7
0
 def test_store_dict_small(self):
     content = {'foo': 1}
     dictionary = {'content': content}
     store_dict(dictionary, {})
     self.assertEqual(json.dumps(content), dictionary.get('content'))
     self.assertEqual(content, fetch_dict(dictionary))
예제 #8
0
 def test_store_big_after_small(self):
     original = {'content': {'foo': 1}}
     updates = {'content': self._get_big_dict()}
     store_dict(updates, original)
     self.assertIsNone(updates['content'])
     self.assertIsNotNone(updates[FILE_ID])
예제 #9
0
 def test_store_dict_small(self):
     content = {'foo': 1}
     dictionary = {'content': content}
     store_dict(dictionary, {})
     self.assertEqual(json.dumps(content), dictionary.get('content'))
     self.assertEqual(content, fetch_dict(dictionary))