def test_build_cancel(self):
     build_response = BuildResponse({'status': {'phase': 'Running'}})
     assert not build_response.cancelled
     build_response.cancelled = True
     assert build_response.cancelled
     assert 'cancelled' in build_response.json['status']
     assert build_response.json['status']['cancelled']
     build_response.cancelled = False
     assert not build_response.cancelled
     assert 'cancelled' in build_response.json['status']
     assert not build_response.json['status'].get('cancelled')
示例#2
0
 def cancel_build(self, build_id):
     response = self.get_build(build_id)
     br = BuildResponse(response.json())
     br.cancelled = True
     url = self._build_url(OCP_BUILD_API_V1, "builds/%s/" % build_id)
     return self._put(url, data=json.dumps(br.json),
                      headers={"Content-Type": "application/json"})
 def test_build_cancel(self):
     build_response = BuildResponse({
         'status': {
             'phase': 'Running'
         }
     })
     assert not build_response.cancelled
     build_response.cancelled = True
     assert build_response.cancelled
     assert 'cancelled' in build_response.json['status']
     assert build_response.json['status']['cancelled']
     build_response.cancelled = False
     assert not build_response.cancelled
     assert 'cancelled' in build_response.json['status']
     assert not build_response.json['status'].get('cancelled')
     assert not build_response.is_cancelled()