e2e: cleanup tests, remove XPATH selectors

This commit is contained in:
Jens Langhammer
2020-09-28 18:17:07 +02:00
parent 67b69cb5d3
commit e54b98a80e
16 changed files with 60 additions and 101 deletions

View File

@ -6,13 +6,13 @@
<div class="pf-c-form__group">
<p>
{% blocktrans with name=context.application.name %}
You're about to sign into {{ name }}.
You're about to sign into <strong id="application-name">{{ name }}</strong>.
{% endblocktrans %}
</p>
<p>{% trans "Application requires following permissions" %}</p>
<ul class="pf-c-list">
{% for scope in context.scope_descriptions %}
<li>{{ scope }}</li>
<ul class="pf-c-list" id="scopes">
{% for scope_name, description in context.scope_descriptions.items %}
<li id="scope-{{ scope_name }}">{{ description }}</li>
{% endfor %}
</ul>
{{ hidden_inputs }}

View File

@ -22,14 +22,14 @@ class UserInfoView(View):
"""Create a dictionary with all the requested claims about the End-User.
See: http://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse"""
def get_scope_descriptions(self, scopes: List[str]) -> List[str]:
def get_scope_descriptions(self, scopes: List[str]) -> Dict[str, str]:
"""Get a list of all Scopes's descriptions"""
scope_descriptions = []
scope_descriptions = {}
for scope in ScopeMapping.objects.filter(scope_name__in=scopes).order_by(
"scope_name"
):
if scope.description != "":
scope_descriptions.append(scope.description)
scope_descriptions[scope.scope_name] = scope.description
# GitHub Compatibility Scopes are handeled differently, since they required custom paths
# Hence they don't exist as Scope objects
github_scope_map = {
@ -44,7 +44,7 @@ class UserInfoView(View):
}
for scope in scopes:
if scope in github_scope_map:
scope_descriptions.append(github_scope_map[scope])
scope_descriptions[scope] = github_scope_map[scope]
return scope_descriptions
def get_claims(self, token: RefreshToken) -> Dict[str, Any]: