def test__generate_item_parsing_specs_fail(self, *mocks): """Test for fetch_agent_locally method parsing specs fail.""" ctx_mock = ContextMock() with self.assertRaises(ClickException) as cm: _generate_item(ctx_mock, "protocol", "path") expected_msg = ( "The following error happened while parsing the protocol specification" ) self.assertIn(expected_msg, cm.exception.message)
def test__generate_item_no_res(self, *mocks): """Test for fetch_agent_locally method no black.""" ctx_mock = ContextMock() with self.assertRaises(ClickException) as cm: _generate_item(ctx_mock, "protocol", "path") expected_msg = ( "Please install black code formater first! See the following link: " "https://black.readthedocs.io/en/stable/installation_and_usage.html" ) self.assertEqual(cm.exception.message, expected_msg)
def test__generate_item_no_res_isort_missing(self, *_mocks): """Test for fetch_agent_locally method no isort.""" ctx_mock = ContextMock() with self.assertRaises(ClickException) as cm: _generate_item(ctx_mock, "protocol", "path") expected_msg = ( "Protocol is NOT generated. The following error happened while generating the protocol:\n" "Cannot find isort code formatter! To install, please follow this link: " "https://pycqa.github.io/isort/#installing-isort") self.assertEqual(cm.exception.message, expected_msg)
def test__generate_item_no_res(self, *mocks): """Test for fetch_agent_locally method no black.""" ctx_mock = ContextMock() with self.assertRaises(ClickException) as cm: _generate_item(ctx_mock, "protocol", "path") expected_msg = ( "Protocol is NOT generated. The following error happened while generating the protocol:\n" "Cannot find black code formatter! To install, please follow this link: " "https://black.readthedocs.io/en/stable/installation_and_usage.html" ) self.assertEqual(cm.exception.message, expected_msg)
def test__generate_item_file_exists(self, *mocks): """Test for fetch_agent_locally method file exists result.""" ctx_mock = ContextMock() with self.assertRaises(ClickException): _generate_item(ctx_mock, "protocol", "path")
def test__generate_item_file_exists(self, *mocks): """Test for fetch_agent_locally method positive result.""" ctx_mock = ContextMock() with self.assertRaises(SystemExit): _generate_item(ctx_mock, "protocol", "path")