def test_job_run_without_keepdays(self): """ Test execution of job run. """ # Mock the call to _remove_older to make verification. p = RemoveOlder(cherrypy.engine, self.app) p._remove_older = MagicMock() # Call the job. p.job_run() # Check if _remove_older was called p._remove_older.assert_not_called()
def test_job_run_with_keepdays(self): """ Test execution of job run. """ # Mock the call to _remove_older to make verification. p = RemoveOlder(cherrypy.engine, self.app) p._remove_older = MagicMock() # Set a keepdays user = self.app.userdb.get_user(self.USERNAME) repo = user.get_repo(self.REPO) repo.keepdays = 30 # Call the job. p.job_run() # Check if _remove_older was called p._remove_older.assert_called_once_with(user, repo, 30)