def test_do_add_category(self, mock_stdout): manage.CONF = mock.MagicMock() manage.CONF.command.category_name = 'test_category_name' expected_output = ">> Successfully added category test_category_name" manage.do_add_category() self.assertEqual(expected_output, mock_stdout.getvalue().replace('\n', ''))
def test_do_add_category_except_duplicate_error(self, mock_stdout): manage.CONF = mock.MagicMock() manage.CONF.command.category_name = 'test_category_name' expected_output = ">> ERROR: Category \'test_category_name\' already "\ "exists" db_catalog_api.category_add('test_category_name') manage.do_add_category() self.assertEqual(expected_output, mock_stdout.getvalue().replace('\n', ''))