# Scenario step implementations for locally managed Qvisqve ## Configure Qvisqve and its API client IMPLEMENTS GIVEN an API client "(\S+)" V['client_id'] = get_next_match() IMPLEMENTS GIVEN API client has secret "(.+)" V['client_secret'] = get_next_match() IMPLEMENTS GIVEN API client has allowed scopes "(.+)" scopes = get_next_match() V['allowed_scopes'] = scopes.split() IMPLEMENTS GIVEN a Qvisqve configuration for "(.+)" V['iss'] = get_next_match() IMPLEMENTS GIVEN Qvisqve configuration has a token lifetime of (\d+) V['lifetime'] = int(get_next_match()) IMPLEMENTS GIVEN Qvisqve configuration has user account (\S+) with password (\S+) username = get_next_match() password = get_next_match() V['users'] = { username: password } IMPLEMENTS GIVEN Qvisqve configuration has application (\S+) with callback url (\S+) and secret (\S+) and allowed scopes (.+) app = get_next_match() callback = get_next_match() secret = get_next_match() scopestr = get_next_match() # FIXME: store secret somewhere V['applications'] = { app: callback } V['client_id'] = app V['client_secret'] = secret V['allowed_scopes'] = scopestr.split() ## Authentication setup IMPLEMENTS GIVEN an RSA key pair for token signing argv = [ os.path.join(srcdir, 'generate-rsa-key'), 'token.key', ] cliapp.runcmd(argv, stdout=None, stderr=None) IMPLEMENTS GIVEN an access token for (\S+) with scopes (.+) user = get_next_match() scopes = get_next_match() key = V['privkey'] issuer = V['iss'] audience = V['aud'] token = create_token(key, issuer, audience, scopes) V['token'] = token ## Start Qvisqve IMPLEMENTS GIVEN a running Qvisqve instance start_qvisqve() assert V['API_URL'] is not None ## Stop a Qvisqve we started IMPLEMENTS FINALLY Qvisqve is stopped stop_qvisqve()