def test_add_db_with_enough_max_cache_size(self): # Default max_cache_size value is 1024, and default db already # occupies 16 Mo db_name = 'testdb' db_options = DatabaseOptions(block_cache_size=from_mo_to_bytes(32)) # max_cache_size = default cache_size + 16 status, content = self.handler.add(db_name, db_options) self.assertEqual(status, SUCCESS_STATUS)
def test_add_db_and_overflow_max_cache_size(self): orig_value = self.env["global"]["max_cache_size"] db_name = 'testdb' db_options = DatabaseOptions(block_cache_size=from_mo_to_bytes(1000)) self.env["global"]["max_cache_size"] = 32 # max_cache_size = default cache_size + 16 status, content = self.handler.add(db_name, db_options) self.assertEqual(status, FAILURE_STATUS) self.assertIsNotNone(content) self.assertIsInstance(content, list) self.assertEqual(len(content), 2) self.assertEqual(content[0], DATABASE_ERROR) self.env["global"]["max_cache_size"] = orig_value