Skip to content

Commit

Permalink
Allow charset parameter in Content-Type
Browse files Browse the repository at this point in the history
  • Loading branch information
dshafer committed Jul 22, 2025
1 parent b6180b1 commit b29b13f
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions md-query-saml.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Library XML
Resource MDQ.robot
Variables variables.py

*** Keywords ***
Should Have SAML Metadata Content Type Header
[Arguments] ${resp} ${msg}=Response should include Content-Type header set to application/samlmetadata+xml
${content_type_header}= Get From Dictionary ${resp.headers} Content-Type
# Check for application/samlmetadata+xml content type (with optional charset parameter)
Should Match Regexp ${content_type_header} ^application/samlmetadata\\+xml(;\\s*charset=.+)?$ msg=${msg}

*** Test Cases ***
2.2.1 Unique Identifier
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Expand All @@ -21,16 +28,29 @@ Variables variables.py

3.1.2 One Entity Descriptor Returned
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}

Should Have SAML Metadata Content Type Header ${resp} msg=MUST set Content-Type to application/samlmetadata+xml

${root}= Parse XML ${resp.text}

# The root of the XML document MUST be an EntityDescriptor element.
Should Be Equal ${root.tag} EntityDescriptor msg=MUST use EntityDescriptor document element

# The XML document MUST NOT contain any EntitiesDescriptor elements.
Should Not Contain ${resp.text} EntitiesDescriptor msg=MUST NOT use EntitiesDescriptor element
Dictionary Should Contain Item ${resp.headers} content-type application/samlmetadata+xml msg=MUST return Content-Type=application/samlmetadata+xml header

3.1.3 More Than One Entity Descriptor Returned
[Tags] aggregate
${resp}= Get All Entities baseUrl=${BASE_URL}

Should Have SAML Metadata Content Type Header ${resp} msg=MUST set Content-Type to application/samlmetadata+xml

${root}= Parse XML ${resp.text}

# The root of the XML document MUST be an EntitiesDescriptor element.
Should Be Equal ${root.tag} EntitiesDescriptor msg=MUST use EntitiesDescriptor document element

# The XML document MUST NOT contain any other EntitiesDescriptor elements.
${count}= Get Element Count ${root} .//EntitiesDescriptor
Should Be Equal As Integers ${count} 0 msg=MUST NOT contain nested EntitiesDescriptor elements
Dictionary Should Contain Item ${resp.headers} content-type application/samlmetadata+xml msg=MUST return Content-Type=application/samlmetadata+xml header

0 comments on commit b29b13f

Please sign in to comment.