summaryrefslogtreecommitdiffstats
path: root/tests/helpers/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/helpers/http.py')
-rwxr-xr-xtests/helpers/http.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/helpers/http.py b/tests/helpers/http.py
index cf59853..d8c56b3 100755
--- a/tests/helpers/http.py
+++ b/tests/helpers/http.py
@@ -266,6 +266,22 @@ class HttpSessions(object):
page.expected_value('//div[@class="alert alert-success"]/p/text()',
'SP Successfully added')
+ def set_sp_default_nameids(self, idp, sp, nameids):
+ """
+ nameids is a list of Name ID formats to enable
+ """
+ idpsrv = self.servers[idp]
+ idpuri = idpsrv['baseuri']
+ url = '%s/%s/admin/providers/saml2/admin/sp/%s' % (idpuri, idp, sp)
+ headers = {'referer': url}
+ headers['content-type'] = 'application/x-www-form-urlencoded'
+ payload = {'submit': 'Submit',
+ 'allowed_nameids': ', '.join(nameids)}
+ r = idpsrv['session'].post(url, headers=headers,
+ data=payload)
+ if r.status_code != 200:
+ raise ValueError('Failed to post SP data [%s]' % repr(r))
+
def fetch_rest_page(self, idpname, uri):
"""
idpname - the name of the IDP to fetch the page from