def wait_until_source_status_code_is(step, code1, code2, secs): start = datetime.utcnow() read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) while (status['code'] != int(code1) and status['code'] != int(code2)): time.sleep(3) assert_less(datetime.utcnow() - start, timedelta(seconds=int(secs))) read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) eq_(status['code'], int(code1))
def wait_until_source_status_code_is(step, code1, code2, secs): start = datetime.utcnow() read.i_get_the_source(step, world.source["resource"]) status = get_status(world.source) while status["code"] != int(code1) and status["code"] != int(code2): time.sleep(3) assert datetime.utcnow() - start < timedelta(seconds=int(secs)) read.i_get_the_source(step, world.source["resource"]) status = get_status(world.source) assert status["code"] == int(code1)
def wait_until_source_status_code_is(step, code1, code2, secs): start = datetime.utcnow() read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) while (status['code'] != int(code1) and status['code'] != int(code2)): time.sleep(3) assert_less(datetime.utcnow() - start, timedelta(seconds=int(secs))) read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) eq_(status['code'], int(code1))
def wait_until_source_status_code_is(step, code1, code2, secs): start = datetime.utcnow() delta = int(secs) * world.delta read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) count = 0 while (status['code'] != int(code1) and status['code'] != int(code2)): count += 1 logged_wait(start, delta, count, "source") read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) eq_(status['code'], int(code1))
def the_source_has_been_created_async(step, secs): start = datetime.utcnow() read.i_get_the_source(step, world.source['resource']) status = get_status(world.resource) count = 0 delta = int(secs) * world.delta while status['code'] == UPLOADING: count += 1 logged_wait(start, delta, count, "source") read.i_get_the_source(step, world.source['resource']) status = get_status(world.source) eq_(world.resource['code'], HTTP_CREATED) # update status world.status = world.resource['code'] world.location = world.resource['location'] world.source = world.resource['object'] # save reference world.sources.append(world.resource['resource'])