def test_should_return_help_page(self, out): with self.assertRaises(SystemExit) as ex: solrcloud_cli(['--help']) output = out.getvalue() self.assertEqual(ex.exception.code, 0) self.assertIn('SolrCloud CLI', output) self.assertIn('positional arguments:', output) self.assertIn('optional arguments:', output)
def test_should_execute_switch_command(self, mock_method): solrcloud_cli(['switch']) mock_method.assert_called_once_with()
def test_should_execute_delete_old_nodes_command(self, mock_method): solrcloud_cli(['delete-old-nodes']) mock_method.assert_called_once_with()
def test_should_execute_add_new_nodes_command(self, mock_method): solrcloud_cli(['add-new-nodes']) mock_method.assert_called_once_with()
def test_should_execute_create_new_cluster_command(self, mock_method): solrcloud_cli(['create-new-cluster']) mock_method.assert_called_once_with()
def test_should_execute_deploy_command(self, mock_method): solrcloud_cli(['deploy']) mock_method.assert_called_once_with()
def test_should_execute_bootstrap_command(self, mock_method): solrcloud_cli(['bootstrap']) mock_method.assert_called_once_with()
def test_should_return_error_message_and_usage_page_if_config_file_does_not_exist(self, out): solrcloud_cli(['-f', 'unknown.file', 'unknown']) output = out.getvalue() self.assertIn('Configuration file does not exist: unknown.file', output) self.assertIn('usage: ', output)
def test_should_return_error_message_and_usage_page_if_command_is_unknown(self, out): solrcloud_cli(['unknown']) output = out.getvalue() self.assertIn('Unknown command: unknown', output) self.assertIn('usage: ', output)
def test_should_return_error_if_no_argument_given(self): with self.assertRaises(SystemExit) as ex: solrcloud_cli([]) self.assertEqual(ex.exception.code, 2)