# 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+) app = get_next_match() callback = get_next_match() V['applications'] = { app: callback } ## 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 = open('token.key').read() argv = [ os.path.join(srcdir, 'create-token'), scopes, ] token = cliapp.runcmd(argv, feed_stdin=key) store_token(user, 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()