Skip to content

Commit

Permalink
awslabs#35 Adding in fixes to broken tests, renaming test and data to…
Browse files Browse the repository at this point in the history
… be more readable
  • Loading branch information
ericdbarry committed Jul 27, 2019
1 parent 9e1855b commit b864ab8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions awsprocesscreds/saml.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def _retrieve_login_form_from_endpoint(self, endpoint):
if not form_action.lower().startswith('https://'):
raise SAMLError('Your SAML IdP must use HTTPS connection')
payload = dict((tag.attrib['name'], tag.attrib.get('value', ''))
for tag in login_form_html_node.findall(".//input"))
for tag in login_form_html_node.findall(
".//input[@name]"))
return form_action, payload

def _assert_non_error_response(self, response):
Expand Down Expand Up @@ -287,7 +288,8 @@ def _dict2str(self, d):
# so that the output will be suitable to be fed into an ET later.
parts = []
for k, v in d.items():
escaped_value = escape(v) # pylint: disable=deprecated-method
escaped_value = escape( # pylint: disable=deprecated-method
v) if v is not None else None
parts.append('%s="%s"' % (k, escaped_value))
return ' '.join(sorted(parts))

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_saml.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ def test_input_missing_name_attribute(self, generic_auth,
}
)

def test_boolean_presence_attribute(self, generic_auth,
def test_boolean_attribute_handling(self, generic_auth,
generic_config,
mock_requests_session):
saml_form = (
'<html>'
'<form action="/path/login/">'
'<input boolean-attr name="spam" value="eggs"/>'
'<input attr-is-true name="spam" value="eggs"/>'
'<input name="username"/>'
'<input name="password"/>'
'</form>'
Expand Down

0 comments on commit b864ab8

Please sign in to comment.