def test_add_to_cron(self, mock_open): mock_open().read.return_value = "parameterizedCron '''\n" input_manifests = InputManifests("test") input_manifests.add_to_cron('0.1.2') mock_open.assert_has_calls( [call(InputManifests.cron_jenkinsfile(), 'w')]) mock_open.assert_has_calls( [call(InputManifests.cron_jenkinsfile(), 'r')]) mock_open().write.assert_called_once_with( f"parameterizedCron '''\n{' ' * 12}H/10 * * * * %INPUT_MANIFEST=0.1.2/test-0.1.2.yml;TARGET_JOB_NAME=distribution-build-test\n" )
def test_cron_jenkinsfile(self): self.assertEqual( InputManifests.cron_jenkinsfile(), os.path.realpath( os.path.join(os.path.dirname(__file__), "..", "..", "jenkins", "check-for-build.jenkinsfile")))