Skip to content
Snippets Groups Projects
Commit 0a5c5e9a authored by Mark's avatar Mark
Browse files

Rename variables and steps

parent ff0d04b6
No related branches found
No related tags found
1 merge request!5Service Integration
......@@ -48,7 +48,7 @@ def get_userinfo():
@app.route('/logout')
def logout():
del session['sso_token']
return redirect(LOGOUT_URL)
return redirect(url_for('login'))
@app.route('/callback')
def callback():
......
......@@ -37,20 +37,24 @@ def before_all(context):
def before_tag(context, tag):
values = dict()
userdata = context.config.userdata
values['url'] = userdata.get('url')
values['logout'] = userdata.get('logout_url')
values['userinfo'] = userdata.get('userinfo_url')
values['home'] = userdata.get('url')
values['logout'] = values['home'] + "/logout"
values['userinfo'] = values['home'] + "/userinfo"
values['username'] = userdata.get('username')
values['username2'] = userdata.get('username2')
values['password'] = userdata.get('password')
values['email'] = userdata.get('email')
values['role'] = userdata.get('role')
assert values['url'], 'url variable missing in' \
assert values['home'], 'url variable missing in' \
'userdata. Provide it with "-D url".'
assert values['username'], 'username variable missing in' \
'userdata. Provide it with "-D username".'
assert values['password'], 'password variable missing in' \
'userdata. Provide it with "-D password".'
assert values['email'], 'email variable missing in' \
'userdata. Provide it with "-D email".'
assert values['role'], 'role variable missing in' \
'userdata. Provide it with "-D role".'
context.oauth = values
......
......@@ -4,43 +4,32 @@ Feature: Test login-provider function
I want to be able to login to an OAS App
And verify my userdata that is provided by OpenID Connect
Scenario: Open the oAuth application
When I open the URL "url"
Then I wait on element "input#username" for 1000ms to be visible
Scenario: Login with a valid user with access to application
Given the element "input#username" is visible
Scenario: Open the oAuth application and Login witha valid user
Given the oauth client "home" URL was opened
And the element "input#username" is visible
When I enter the "username" in the inputfield "input#username"
And I enter the "password" in the inputfield "input#password"
And I click on the button "input#submit"
Then I wait on element "input#password" for 1000ms to not exist
Scenario: Wait for the oAuth flow to finish and check if access token is present
Given the element "input#password" does not exist
Then I expect that the path is "/callback"
And I expect that the path is "/callback"
And I expect that element "body" contains the text "access_token"
Scenario: Get OpenID Connect userdata for testuser
When I open the url "userinfo"
When I open the oauth client "userinfo" URL
Then I expect that the "preferred_username" in the json output is "username"
And I expect that the "email" in the json output is "email"
And I expect that the "openappstack_roles" in the json output contains "role"
And I expect that the "name" in the json output is "username"
Scenario: Logout
When I open the URL "logout"
Then I wait on element "input#username" for 1000ms to be visible
And I expect that element "input#password" is visible
And I expect that element "input#submit" is visible
Scenario: Navigate to Login page after logout
When I open the URL "url"
When I open the oauth client "logout" URL
Then I wait on element "input#username" for 1000ms to be visible
And I expect that element "input#password" is visible
And I expect that element "input#submit" is visible
Scenario: Login with a valid user without access to an application
Given the element "input#username" is visible
Given the oauth client "home" URL was opened
And the element "input#username" is visible
When I enter the "username2" in the inputfield "input#username"
And I enter the "password" in the inputfield "input#password"
And I click on the button "input#submit"
......
......@@ -10,8 +10,8 @@ from behave_webdriver.steps import *
def before_all(context):
pass # login and save cookies here
@when(u'I open the URL "{url}"')
@given(u'I open the URL "{url}"')
@when(u'I open the oauth client "{url}" URL')
@given(u'The oauth client "{url}" URL was opened')
def step_impl(context, url):
context.behave_driver.get(context.oauth[url])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment