def test_cancelation_by_lookup(self):
        with client.test_mode as t:
            t.register_json('/jobs/?name=bar', {"count": 1, "results": [
                {"id": 42, "name": "bar"},
            ], "next": None, "previous": None}, method='GET')
            t.register('/jobs/42/cancel/', '', method='POST')
            result = self.res.cancel(name="bar")
            self.assertTrue(t.requests[0].url.endswith('/jobs/?name=bar'))
            self.assertTrue(t.requests[1].url.endswith('/jobs/42/cancel/'))
            self.assertTrue(result['changed'])
Establish that a job can be canceled by name or identity
dataset/ETHPy150Open ansible/tower-cli/tests/test_resources_job.py/CancelTests.test_cancelation_by_lookup