diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a3b32a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +log.html +output.xml +pip-selfcheck.json +report.html diff --git a/All_Entities.robot b/All_Entities.robot new file mode 100644 index 0000000..9ce2c13 --- /dev/null +++ b/All_Entities.robot @@ -0,0 +1,28 @@ +*** Settings *** +Library XML +Resource MDQ.robot +Default Tags all-entities + +*** Test Cases *** +Get All Entities + [Documentation] GET all entities + [Tags] http-get + ${resp}= Get uri=/entities + Should Be Equal As Strings ${resp.status_code} 200 + #${root}= Parse XML ${resp.text} + #Should Be Equal ${root.tag} EntitiesDescriptor + +Gzip Encoding + [Documentation] GET all entities with gzip encoding + [Tags] http-get gzip + ${resp}= Get With Gzip uri=/entities/urn:mace:incommon:internet2.edu + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal ${resp.encoding} gzip + #${root}= Parse XML ${resp.text} + #Should Be Equal ${root.tag} EntitiesDescriptor + +Head All Entities + [Documentation] HEAD all entities + [Tags] http-head + ${resp}= Head uri=/entities + Should Be Equal As Strings ${resp.status_code} 200 diff --git a/MDQ.robot b/MDQ.robot new file mode 100644 index 0000000..6f2ed0d --- /dev/null +++ b/MDQ.robot @@ -0,0 +1,23 @@ +*** Settings *** +Library RequestsLibrary + +*** Keywords *** +Get + [Arguments] ${uri} + Create Session alias=md url=http://md.sandbox.ti.internet2.edu + ${resp}= Get Request alias=md uri=${uri} + [Return] ${resp} + +Get With Gzip + [Arguments] ${uri} + Create Session alias=md url=http://md.sandbox.ti.internet2.edu + &{headers}= Create Dictionary Accept-Encoding=gzip + ${resp}= Get Request alias=md uri=${uri} headers=&{headers} + [Return] ${resp} + +Head + [Arguments] ${uri} + Log ${uri} + Create Session alias=md url=http://md.sandbox.ti.internet2.edu + ${resp}= Head Request alias=md uri=${uri} + [Return] ${resp} diff --git a/README.md b/README.md index 0044e5c..a755f2e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,57 @@ # md-query-saml-uat + User acceptance tests for a service implementing the SAML metadata profile of the Metadata Query Protocol + + +## Prerequisites + +1. Install Robot Framework (see https://github.com/robotframework/robotframework/blob/master/INSTALL.rst) + + +## Quick Start + +1. Clone this repository: + ``` + git clone https://github.internet2.edu/internet2/md-query-saml-uat.git + ``` + +2. Run the robot test suite: + ``` + robot . + ``` + + +## Usage + +Run all tests: + +``` +robot . +``` + +Run metadata aggregate tests: + +``` +robot All_Entities.robot +``` + +Run single entity tests: + +``` +robot Single_Entity.robot +``` + + +## To Do + +1. Isolate Python dependencies with `virtualenv` or similar. + + +## Contributing + +1. Clone the repository. +2. Create a new feature branch (optionally named for a JIRA issue, if applicable, e.g. `MDQ-1234-my-feature`). +3. Commit your changes and push to GitHub Enterprise. +4. Create a pull request from your feature branch against the `master` branch. +5. Merge your pull request to the `master` branch. +6. After your changes are merged, you can delete your feature branch. diff --git a/Single_Entity.robot b/Single_Entity.robot new file mode 100644 index 0000000..caa9fb1 --- /dev/null +++ b/Single_Entity.robot @@ -0,0 +1,77 @@ +*** Settings *** +Library XML +Resource MDQ.robot +Default Tags single-entity + +*** Test Cases *** +URN-Style Entity ID + [Documentation] GET an entity with a URN-style entityID + [Tags] http-get entity-id-urn + ${resp}= Get uri=/entities/urn:mace:incommon:internet2.edu + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +URL-Style Entity ID + [Documentation] GET an entity with a URL-style entityID + [Tags] http-get entity-id-url + ${resp}= Get uri=/entities/https:%2f%2fcarmenwiki.osu.edu%2fshibboleth + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +Gzip Encoding + [Documentation] GET an entity with gzip encoding + [Tags] http-get entity-id-urn gzip + ${resp}= Get With Gzip uri=/entities/urn:mace:incommon:internet2.edu + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal ${resp.encoding} gzip + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +Colons Encoded + [Documentation] GET an entity with colons in the entityID percent-encoded + [Tags] http-get entity-id-urn encode-colons + ${resp}= Get uri=/entities/urn%3Amace%3Aincommon%3Ainternet2.edu + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +Lowercase Encoding + [Documentation] GET an entity using lowercase percent-encoding + [Tags] http-get entity-id-url encoding-lowercase + ${resp}= Get uri=/entities/https:%2f%2fcarmenwiki.osu.edu%2fshibboleth + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +Uppercase Encoding + [Documentation] GET an entity using uppercase percent-encoding + [Tags] http-get entity-id-url encoding-uppercase + ${resp}= Get uri=/entities/https:%2F%2Fcarmenwiki.osu.edu%2Fshibboleth + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + + SHA-1 Hash (Lowercase) + [Documentation] GET an entity by the lowercase SHA-1 hash of its entityID + [Tags] http-get sha-1 sha-1-lowercase + # `$ echo urn:mace:incommon:internet2.edu |shasum` + ${resp}= Get uri=/entities/15fd47b743804831a6a443a37170c8983116c7a2 + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +SHA-1 Hash (Uppercase) + [Documentation] GET an entity by the uppercase SHA-1 hash of its entityID + [Tags] http-get sha-1 sha-1-uppercase + ${resp}= Get uri=/entities/15FD47B743804831A6A443A37170C8983116C7A2 + Should Be Equal As Strings ${resp.status_code} 200 + ${root}= Parse XML ${resp.text} + Should Be Equal ${root.tag} EntityDescriptor + +Head Entity + [Documentation] HEAD an entity + [Tags] http-head entity-id-urn + ${resp}= Head uri=/entities/urn:mace:incommon:internet2.edu + Should Be Equal As Strings ${resp.status_code} 200 diff --git a/__init__.robot b/__init__.robot new file mode 100644 index 0000000..e46f343 --- /dev/null +++ b/__init__.robot @@ -0,0 +1,4 @@ +*** Settings *** +Documentation Acceptance test suite for a service implementing the SAML +... metadata profile of the Metadata Query Protocol +... (https://tools.ietf.org/html/draft-young-md-query-saml-09).