Пример #1
0
    def test_download(self):
        classname = "AgentUnittest" + os.urandom(8).encode("hex")
        cache = Cache()

        with APITestServer(
            "/jobtypes/%s/versions/1" % classname,
            headers={"Content-Type": "application/json"},
            code=OK, response=json.dumps({"data": "This is a job type"})
        ):
            response = yield cache._download_jobtype(classname, 1)
            self.assertEqual(response.code, OK)
            data = response.json()
            self.assertEqual(data.get("data"), "This is a job type")