def resolve_uaac_args(context, args, cwd): if args[1] == 'target': args[2] = resolve.url(context, args[2]) elif args[1] == 'client': if '--redirect_uri' in args: uri_idx = args.index('--redirect_uri') + 1 uri = args[uri_idx] args[uri_idx] = resolve.url(context, uri)
def step_impl(context, data, url): url = resolve.url(context, url) fields = data.split('=') assert len(fields) == 2, 'Invalid data format: {}'.format(data) payload = {fields[0]: fields[1]} context.log.info('posting url {} {}'.format(url, payload)) context.browser = mechanicalsoup.StatefulBrowser() resp = context.browser.post(url, data=payload) context.log.info('POST {} [{}]'.format(url, resp.status_code))
def step_impl(context, data, url): url = resolve.url(context, url) fields = data.split('=') assert len(fields) == 2, 'Invalid data format: {}'.format(data) payload = { fields[0]: fields[1] } context.log.info('posting url {} {}'.format(url, payload)) context.browser = mechanicalsoup.StatefulBrowser() resp = context.browser.post(url, data=payload) context.log.info('POST {} [{}]'.format(url, resp.status_code))
def step_impl(context, app): url = resolve.url(context, 'https://{}.x.y.z/cloudfoundryapplication'.format(app)) token = get_oauth_token(context) resp = requests.get(url, headers={'Authorization': token}) resp.status_code.should.equal(200) context.log.info(resp.content) for endpoint in ['info', 'health', 'loggers', 'trace', 'mappings']: resp.text.should.contain( '/cloudfoundryapplication/{}'.format(endpoint))
def step_impl(context, url): url = resolve.url(context, url) context.log.info('getting url {}'.format(url)) context.browser = mechanicalsoup.StatefulBrowser() attempt = 0 while True: attempt += 1 resp = context.browser.open(url) if resp.status_code < 500: context.log.info('GET {} [{}]'.format(url, resp.status_code)) resp.status_code.should.equal(200) break context.log.info('failed to get {} [{}]'.format(url, resp.status_code)) if attempt > 5: raise Exception('Unable to get page {} [{}]'.format(url, resp.status_code)) time.sleep(1)
def resolve_cf_args(context, args, cwd): if args[1] == 'push': if '-f' in args: manifest = os.path.join(cwd, args[args.index('-f') + 1]) with open(manifest, 'r', encoding='utf-8-sig') as f: doc = f.read() match = re.search('- name:\s+(\S+)', doc) if match: app = match.group(1) args += ['--hostname', resolve.hostname(context, app)] elif args[1] == 'cups': if '-p' in args: creds_idx = args.index('-p') + 1 creds = args[creds_idx] match = re.search('"(uaa://[^"]+)', creds) if match: url = match.group(1) args[creds_idx] = creds.replace(url, resolve.url(context, url))
def resolve_cf_args(context, args, cwd): if args[1] == 'push': if '-f' in args: manifest = os.path.join(cwd, args[args.index('-f') + 1 ]) with open(manifest, 'r', encoding='utf-8-sig') as f: doc = f.read() match =re.search('- name:\s+(\S+)', doc) if match: app = match.group(1) args += ['--hostname', resolve.hostname(context, app)] elif args[1] == 'cups': if '-p' in args: creds_idx = args.index('-p') + 1 creds = args[creds_idx] match = re.search('"(uaa://[^"]+)', creds) if match: url = match.group(1) args[creds_idx] = creds.replace(url, resolve.url(context, url))
def step_impl(context, url): context.browser.get_url().should.match(r'{}(\?.*)?'.format( resolve.url(context, url)))
def step_impl(context, url): context.browser.get_url().should.match(r'{}(\?.*)?'.format(resolve.url(context, url)))