예제 #1
0
 def test_delete_job(self):
     """
     DkronJob: Test delete
     """
     job = DkronJob(self.client, name="job1")
     with requests_mock.Mocker() as mocker:
         exp = job.marshal()
         mocker.register_uri(
             requests_mock.DELETE,
             "http://localhost:8080/v1/jobs/job1",
             text=exp,
             status_code=200,
         )
         got = json.dumps(job.delete())
         self.assertEqual(exp, got, "Exp: '%s', Got: '%s'" % (exp, got))
예제 #2
0
    def test_save(self):
        """
        DkronJob: Test saving job
        """
        job = DkronJob(self.client, name="job1")
        with requests_mock.Mocker() as mocker:
            exp = job.marshal()
            mocker.register_uri(
                requests_mock.POST,
                "http://localhost:8080/v1/jobs",
                text=exp,
                status_code=201,
            )

            got = json.dumps(job.save())
            self.assertEqual(exp, got, "Exp: '%s', Got: '%s'" % (exp, got))