def test_state_checkers(self): build_response = BuildResponse({ 'status': { 'phase': 'Complete' } }) build_response.status = 'complete' assert build_response.is_finished() assert build_response.is_succeeded() assert not build_response.is_failed() assert not build_response.is_cancelled() assert not build_response.is_running() assert not build_response.is_pending() assert not build_response.is_in_progress() build_response.status = 'failed' assert build_response.is_failed() assert build_response.is_finished() assert not build_response.is_succeeded() assert not build_response.is_cancelled() assert not build_response.is_running() assert not build_response.is_pending() assert not build_response.is_in_progress() build_response.status = 'cancelled' assert build_response.is_cancelled() assert build_response.is_failed() assert build_response.is_finished() assert not build_response.is_succeeded() assert not build_response.is_running() assert not build_response.is_pending() assert not build_response.is_in_progress() build_response.status = 'running' assert build_response.is_running() assert build_response.is_in_progress() assert not build_response.is_cancelled() assert not build_response.is_failed() assert not build_response.is_finished() assert not build_response.is_succeeded() assert not build_response.is_pending() build_response.status = 'pending' assert build_response.is_pending() assert build_response.is_in_progress() assert not build_response.is_running() assert not build_response.is_cancelled() assert not build_response.is_failed() assert not build_response.is_finished() assert not build_response.is_succeeded()
def _get_running_builds_for_build_config(self, build_config_id): all_builds_for_bc = self.os.list_builds(build_config_id=build_config_id).json()['items'] running = [] for b in all_builds_for_bc: br = BuildResponse(b) if br.is_pending() or br.is_running(): running.append(br) return running
def _get_running_builds_for_build_config(self, build_config_id, namespace=DEFAULT_NAMESPACE): all_builds_for_bc = self.os.list_builds( build_config_id=build_config_id, namespace=namespace).json()['items'] running = [] for b in all_builds_for_bc: br = BuildResponse(request=None, build_json=b) if br.is_pending() or br.is_running(): running.append(br) return running