暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_db_init.py 1.1KB

1234567891011121314151617181920212223242526
  1. # -*- coding: utf-8 -*-
  2. import unittest
  3. from plugins.mongodb_datasource.migration_handler import *
  4. class MongoDbMigrationHandlerTestCase(unittest.TestCase):
  5. def test_check_connection_args(self):
  6. empty_connection_args = {}
  7. with self.assertRaises(TypeError):
  8. MigrationHandler(empty_connection_args)
  9. bad_connection_args_dicts = [
  10. {'host': 'localhost', 'port': 20030},
  11. {'host': 'localhost', 'port': 28015},
  12. {'host': 'localhost', 'port': 28015, 'login':'lodel', 'password': 'lap'}
  13. ]
  14. for bad_connection_args_dict in bad_connection_args_dicts:
  15. with self.assertRaises(TypeError):
  16. MigrationHandler(bad_connection_args_dict)
  17. ## @todo pass the connection arguments in the settings
  18. @unittest.skip
  19. def test_init_db(self):
  20. correct_connection_args = {'host': 'localhost', 'port': 28015, 'username': 'lodel_admin', 'password': 'lapwd', 'db_name': 'lodel'}
  21. migration_handler = MigrationHandler(correct_connection_args)
  22. migration_handler.init_db()