def test_run_sqlalchmey_operational_failure(self): class SQLAlchemyCommands(object): def operational_failure(self): raise sqlalchemy.exc.OperationalError("Can't open DB file") ret = cliutils.run(["rally", "failure", "operational_failure"], {"failure": SQLAlchemyCommands}) self.assertEqual(1, ret)
def test_run_failed_to_open_file(self, mock_api_check_db_revision): class FailuresCommands(object): def failed_to_open_file(self): raise IOError("No such file") ret = cliutils.run(["rally", "failure", "failed-to-open-file"], {"failure": FailuresCommands}) self.assertEqual(1, ret)
def test_run_failed_to_open_file(self): class FailuresCommands(object): def failed_to_open_file(self): raise IOError("No such file") ret = cliutils.run(["rally", "failure", "failed_to_open_file"], {"failure": FailuresCommands}) self.assertEqual(1, ret)
def test_run_show(self): ret = cliutils.run(["rally", "show", "keypairs"], self.categories) self.assertEqual(ret, 1)
def test_run_bash_completion(self): ret = cliutils.run(["rally", "bash-completion"], self.categories) self.assertEqual(ret, 0)
def test_run_bash_completion(self, mock_api_check_db_revision): ret = cliutils.run(["rally", "bash-completion"], self.categories) self.assertEqual(0, ret)
def main(): categories = {"db": DBCommands, "tempest": TempestCommands} cliutils.run(sys.argv, categories)
def test_run_task_failed(self, mock_validate_args, mock_api_check_db_revision): ret = cliutils.run(["rally", "task", "status", "%s" % FAKE_TASK_UUID], self.categories) self.assertTrue(mock_validate_args.called) self.assertEqual(1, ret)
def test_run_bash_completion_with_query_category(self): ret = cliutils.run(["rally", "bash-completion", "info"], self.categories) self.assertEqual(ret, 0)
def test_run_show_fails(self, mock_validate_args): ret = cliutils.run(["rally", "show", "keypairs"], self.categories) self.assertTrue(mock_validate_args.called) self.assertEqual(ret, 1)
def test_run_version(self): ret = cliutils.run(["rally", "version"], self.categories) self.assertEqual(ret, 0)
def test_run_fails(self, mock_cliutils_conf): ret = cliutils.run(["rally", "show", "flavors"], self.categories) self.assertEqual(ret, 2)
def main(): categories = {"db": db.DBCommands} print("`rally-manage db <command>` was deprecated since 0.10.0 version " "and is going to be removed soon. Please use `rally db <command>`.") return cliutils.run(sys.argv, categories)
def test_run_task_not_found(self, mock_task_get): ret = cliutils.run(["rally", "task", "status", "%s" % FAKE_TASK_UUID], self.categories) self.assertTrue(mock_task_get.called) self.assertEqual(ret, 1)
def main(): return cliutils.run(sys.argv, categories)
def test_run_fails(self, mock_rally_api_api): ret = cliutils.run(["rally", "task list"], self.categories) self.assertEqual(2, ret) mock_rally_api_api.assert_called_once_with(config_args=["task list"], skip_db_check=True)
def test_run_task_not_found(self, mock_task_get, mock_api_check_db_revision): ret = cliutils.run(["rally", "task", "status", "%s" % FAKE_TASK_UUID], self.categories) self.assertTrue(mock_task_get.called) self.assertEqual(203, ret)
def test_run_version(self, mock_api_check_db_revision): ret = cliutils.run(["rally", "version"], self.categories) self.assertEqual(ret, 0)
def main(): categories = {"db": DBCommands} return cliutils.run(sys.argv, categories)
def test_run_fails(self, mock_rally_api_api): ret = cliutils.run(["rally", "version"], self.categories) self.assertEqual(2, ret) mock_rally_api_api.assert_called_once_with( config_args=["version"], skip_db_check=True)