本文整理汇总了Python中simple_db_migrate.cli.CLI类的典型用法代码示例。如果您正苦于以下问题:Python CLI类的具体用法?Python CLI怎么用?Python CLI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_it_should_show_error_message_and_exit
def test_it_should_show_error_message_and_exit(self, msg_mock):
try:
CLI.error_and_exit("error test message, dont mind about it :)")
self.fail("it should not get here")
except:
pass
msg_mock.assert_called_with("[ERROR] error test message, dont mind about it :)\n", "RED")
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:7,代码来源:cli_test.py
示例2: test_it_should_show_info_message_and_exit
def test_it_should_show_info_message_and_exit(self, msg_mock):
try:
CLI.info_and_exit("info test message, dont mind about it :)")
self.fail("it should not get here")
except:
pass
msg_mock.assert_called_with("info test message, dont mind about it :)\n", "BLUE")
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:7,代码来源:cli_test.py
示例3: test_it_should_define_colors_values_when_asked_to_show_collors
def test_it_should_define_colors_values_when_asked_to_show_collors(self):
CLI.show_colors()
self.assertEqual("\033[35m", CLI.color["PINK"])
self.assertEqual("\033[34m", CLI.color["BLUE"])
self.assertEqual("\033[36m", CLI.color["CYAN"])
self.assertEqual("\033[32m", CLI.color["GREEN"])
self.assertEqual("\033[33m", CLI.color["YELLOW"])
self.assertEqual("\033[31m", CLI.color["RED"])
self.assertEqual("\033[0m", CLI.color["END"])
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:9,代码来源:cli_test.py
示例4: test_it_should_exit_with_help_options
def test_it_should_exit_with_help_options(self, stdout_mock):
try:
CLI.parse(["-h"])
except SystemExit as e:
self.assertEqual(0, e.code)
self.assertTrue(stdout_mock.getvalue().find("Displays simple-db-migrate's version and exit") > 0)
stdout_mock.buf = ''
try:
CLI.parse(["--help"])
except SystemExit as e:
self.assertEqual(0, e.code)
开发者ID:guilhermechapiewski,项目名称:simple-db-migrate,代码行数:12,代码来源:cli_test.py
示例5: test_it_should_accept_log_dir_options
def test_it_should_accept_log_dir_options(self):
self.assertEqual("log_dir_value", CLI.parse(["--log-dir", "log_dir_value"])[0].log_dir)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例6: test_it_should_accept_log_level_options
def test_it_should_accept_log_level_options(self):
self.assertEqual("log_level_value", CLI.parse(["-l", "log_level_value"])[0].log_level)
self.assertEqual("log_level_value", CLI.parse(["--log-level", "log_level_value"])[0].log_level)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:3,代码来源:cli_test.py
示例7: test_it_should_not_has_a_default_value_for_log_dir
def test_it_should_not_has_a_default_value_for_log_dir(self):
self.assertEqual(None, CLI.parse([])[0].log_dir)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例8: test_it_should_accept_database_name_options
def test_it_should_accept_database_name_options(self):
self.assertEqual("name_value", CLI.parse(["--db-name", "name_value"])[0].database_name)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例9: test_it_should_has_a_default_value_for_log_level
def test_it_should_has_a_default_value_for_log_level(self):
self.assertEqual(1, CLI.parse([])[0].log_level)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例10: test_it_should_has_a_default_value_for_force_files
def test_it_should_has_a_default_value_for_force_files(self):
self.assertEqual(False, CLI.parse([])[0].force_use_files_on_down)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例11: test_it_should_not_has_a_default_value_for_schema_version
def test_it_should_not_has_a_default_value_for_schema_version(self):
self.assertEqual(None, CLI.parse([])[0].schema_version)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例12: test_it_should_accept_database_port_options
def test_it_should_accept_database_port_options(self):
self.assertEqual(42, CLI.parse(["--db-port", "42"])[0].database_port)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例13: test_it_should_accept_database_host_options
def test_it_should_accept_database_host_options(self):
self.assertEqual("host_value", CLI.parse(["--db-host", "host_value"])[0].database_host)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例14: test_it_should_call_print_statment_with_the_given_message_and_color_codes_when_colors_are_on
def test_it_should_call_print_statment_with_the_given_message_and_color_codes_when_colors_are_on(self, stdout_mock):
CLI.show_colors()
CLI.msg("message to print")
self.assertEqual("\x1b[36mmessage to print\x1b[0m\n", stdout_mock.getvalue())
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:4,代码来源:cli_test.py
示例15: test_it_should_use_color_code_to_the_specified_color
def test_it_should_use_color_code_to_the_specified_color(self, stdout_mock):
CLI.show_colors()
CLI.msg("message to print", "RED")
self.assertEqual("\x1b[31mmessage to print\x1b[0m\n", stdout_mock.getvalue())
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:4,代码来源:cli_test.py
示例16: test_it_should_call_print_statment_with_the_given_message
def test_it_should_call_print_statment_with_the_given_message(self, stdout_mock):
CLI.msg("message to print")
self.assertEqual("message to print\n", stdout_mock.getvalue())
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:3,代码来源:cli_test.py
示例17: test_it_should_accept_migrations_dir_options
def test_it_should_accept_migrations_dir_options(self):
self.assertEqual(".:../:/tmp", CLI.parse(["--db-migrations-dir", ".:../:/tmp"])[0].database_migrations_dir)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例18: test_it_should_not_has_a_default_value_for_migrations_dir
def test_it_should_not_has_a_default_value_for_migrations_dir(self):
self.assertEqual(None, CLI.parse([])[0].database_migrations_dir)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例19: test_it_should_has_a_default_value_for_force_old_migrations
def test_it_should_has_a_default_value_for_force_old_migrations(self):
self.assertEqual(False, CLI.parse([])[0].force_execute_old_migrations_versions)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
示例20: test_it_should_not_has_a_default_value_for_new_migration
def test_it_should_not_has_a_default_value_for_new_migration(self):
self.assertEqual(None, CLI.parse([])[0].new_migration)
开发者ID:SufianHassan,项目名称:simple-db-migrate,代码行数:2,代码来源:cli_test.py
注:本文中的simple_db_migrate.cli.CLI类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论