def test_execution_is_suppressed_when_jrebel_not_discovered(self): #having self.args.jrebel = True tomcat_starter = MockTomcatStarter(self.args, False, MockFileUtils().expect_possible_idea_plugin_dirs(toReturn=[])) log = Mock() #when return_code = tomcat_starter(log) #then self.assertEqual(return_code, Callable.do_not_proceed, 'Expected successful return code') self.assertTrue(log.callcount_error() > 0) # verify, that jrebel related error message was logged: self.assertTrue(reduce(lambda r, e: r or 'jrebel' in e, log.error.made_calls, False))
def test_validate_workspace_params_fails_without_workspace(self): fileutils = MockFileUtils() workspace_dir = '/home/abracadabra/IdeaProjects/rest-workspace' jira_project_dir = 'jira-project' pom_xml = 'pom.xml' fileutils.expect_getcwd(toReturn=os.sep.join([workspace_dir, jira_project_dir])) fileutils.expect_file_exists(os.sep.join([workspace_dir, pom_xml]), toReturn=False) fileutils.expect_get_parent_dir_path(toReturn=workspace_dir) logger = Mock() callable_status = WorkspaceValidator(fileutils)(logger) self.assertEqual(logger.callcount_error(), 1) self.assertEqual(callable_status, Callable.failure)
def test_execution_is_suppressed_when_jrebel_not_discovered(self): #having self.args.jrebel = True tomcat_starter = MockTomcatStarter( self.args, False, MockFileUtils().expect_possible_idea_plugin_dirs(toReturn=[])) log = Mock() #when return_code = tomcat_starter(log) #then self.assertEqual(return_code, Callable.do_not_proceed, 'Expected successful return code') self.assertTrue(log.callcount_error() > 0) # verify, that jrebel related error message was logged: self.assertTrue( reduce(lambda r, e: r or 'jrebel' in e, log.error.made_calls, False))