def test_import_incomplete_path(self, mock_exit): cli._import('foo') error_msg = '[error] please supply full path to your custom renderer.' mock_exit.assert_called_with(error_msg)
def test_import_class_error(self, mock_exit, mock_import_module): cli._import('foo.Renderer') error_msg = '[error] cannot find renderer "Renderer" from module "foo".' mock_exit.assert_called_with(error_msg)
def test_import_success(self, mock_import_module): self.assertEqual(sentinel.RendererCls, cli._import('foo.Renderer'))
def test_import_module_error(self, mock_exit, mock_import_module): cli._import('foo.Renderer') mock_exit.assert_called_with('[error] cannot import module "foo".')