Skip to content
Permalink
Browse files

Add remaining acceptance tests

  • Loading branch information
dshafer committed Oct 26, 2018
1 parent 358bcb5 commit 5ebaca8fe0b0b4c54d3788a2425ff51578e0a769
Showing with 156 additions and 130 deletions.
  1. +2 −0 .gitignore
  2. +0 −28 All_Entities.robot
  3. +15 −0 InCommon.robot
  4. +22 −20 README.md
  5. +0 −78 Single_Entity.robot
  6. +0 −4 __init__.robot
  7. +37 −0 md-query-saml.robot
  8. +59 −0 md-query.robot
  9. +21 −0 variables.py
@@ -1,3 +1,5 @@
__pycache__
.DS_Store
log.html
output.xml
pip-selfcheck.json

This file was deleted.

@@ -0,0 +1,15 @@
*** Settings ***
Library XML
Resource MDQ.robot
Variables variables.py

*** Test Cases ***
URL-Style Entity ID
[Documentation] GET an entity with a URL-style entityID
${resp}= Get uri=/entities/${INC_ENTITY_ID_URL_ENCODED}
Should Be Equal As Strings ${resp.status_code} 200

URN-Style Entity ID
[Documentation] GET an entity with a URN-style entityID
${resp}= Get uri=/entities/${INC_ENTITY_ID_URN}
Should Be Equal As Strings ${resp.status_code} 200
@@ -1,6 +1,14 @@
# md-query-saml-uat

User acceptance tests for a service implementing the SAML metadata profile of the Metadata Query Protocol
User acceptance tests for a service implementing the SAML metadata profile of
the Metadata Query Protocol.

See also:

* [Metadata Query Protocol](https://tools.ietf.org/html/draft-young-md-query-09)
* [SAML Profile for the Metadata Query Protocol](https://tools.ietf.org/html/draft-young-md-query-saml-09)




## Prerequisites
@@ -15,30 +23,25 @@ User acceptance tests for a service implementing the SAML metadata profile of th
git clone https://github.internet2.edu/internet2/md-query-saml-uat.git
```

2. Run the robot test suite:
2. Edit `variables.py` for your environment.

2. Run the test suite:
```
robot .
```


## Usage

Run all tests:

Treat any test cases tagged with `optional` as noncritical:
```
robot .
robot --noncritical optional .
```

Run metadata aggregate tests:

```
robot All_Entities.robot
```

Run single entity tests:

Additionally skip long-running test cases (those that download and parse all
entities):
```
robot Single_Entity.robot
robot --noncritical optional --exclude aggregate .
```


@@ -49,9 +52,8 @@ robot Single_Entity.robot

## 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.
1. Clone the repository
2. Create a new feature branch
3. Commit your changes and push to the repository
4. Create a pull request from your feature branch against the `master` branch
5. After your changes have been merged, you may delete your feature branch

This file was deleted.

This file was deleted.

@@ -0,0 +1,37 @@
# https://tools.ietf.org/html/draft-young-md-query-saml-09

*** Settings ***
Library Collections
Library Process
Library XML
Resource MDQ.robot
Variables variables.py

*** Test Cases ***
2.2.1 Unique Identifier
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Should Be Equal As Strings ${resp.status_code} 200 msg=MUST respond to a unique identifier

2.2.2 Transformed Identifier
${resp}= Get uri=entities/{sha1}${ENTITY_ID_SHA1}
Should Be Equal As Strings ${resp.status_code} 200 msg=MUST respond to SHA-1 transformed identifier

3.1.1 No Entity Descriptors Returned
${resp}= Get uri=entities/foo
Should Be Equal As Strings ${resp.status_code} 404 msg=MUST return HTTP status code 404

3.1.2 One Entity Descriptor Returned
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
${root}= Parse XML ${resp.text}
Should Be Equal ${root.tag} EntityDescriptor msg=MUST use EntityDescriptor document element
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 uri=entities
${root}= Parse XML ${resp.text}
Should Be Equal ${root.tag} EntitiesDescriptor msg=MUST use EntitiesDescriptor document element
${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,0 +1,59 @@
# https://tools.ietf.org/html/draft-young-md-query-09

*** Settings ***
Library Collections
Library Process
Resource MDQ.robot
Variables variables.py

*** Test Cases ***
2.2.1 HTTP Version (Required)
# Using curl because the Requests library doesn't let us specify HTTP version

${Curl} Run Process /usr/bin/curl --http1.0 -i ${BASE_URL}entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
Should Contain ${Curl.stdout} 505 HTTP Version Not Supported msg=MUST NOT support HTTP versions prior to 1.1

${Curl} Run Process /usr/bin/curl --http1.1 -i ${BASE_URL}entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
Should Contain ${Curl.stdout} 200 OK msg=MUST support HTTP version 1.1

2.2.2 HTTP Version (Optional)
[Tags] optional
${Curl} Run Process /usr/bin/curl --http2 -i ${BASE_URL}entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
Should Contain ${Curl.stdout} 200 OK msg=MAY support HTTP versions later than 1.1

2.5 Response Headers (Required)
# Content-Encoding
${resp}= Get With Gzip uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-encoding msg=MUST return Content-Encoding header if compressed
# Content-Type
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-type msg=MUST return Content-Type header
# ETag
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} etag msg=MUST return ETag header

2.5 Response Headers (Optional)
[Tags] optional
#Cache-Control
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header
# Content-Length
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-length msg=SHOULD return Content-Length header
# Last-Modified
${resp}= Get uri=entities/${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} last-modified msg=SHOULD return Last-Modified header

4.1 Conditional Retrieval
[Tags] optional
Get uri=entities/${ENTITY_ID_ENCODED}
${resp}= Get uri=/entities/${ENTITY_ID_ENCODED}
Should Be Equal As Strings ${resp.status_code} 304 msg=SHOULD return HTTP status code 304

# 4.2 Content Caching

4.3 Content Compression
${resp}= Get With Gzip uri=entities/${ENTITY_ID_ENCODED}
Should Be Equal As Strings ${resp.status_code} 200 msg=MUST support gzip compression
Dictionary Should Contain Item ${resp.headers} content-encoding gzip msg=MUST support gzip compression
@@ -0,0 +1,21 @@
# Base Metadata Query server URL
# Example: https://example.org/md/
BASE_URL = "http://md.sandbox.ti.internet2.edu/"

# Any known existing entityID
ENTITY_ID = "urn:mace:incommon:internet2.edu"

# Percent-encoded form of ENTITY_ID above
ENTITY_ID_ENCODED = "urn:mace:incommon:internet2.edu"

# SHA-1 transformed form of ENTITY_ID above
ENTITY_ID_SHA1 = "2cb369971729a3e5e30ad48ae408aeafad613645"

# InCommon URL-style entityID
INC_ENTITY_ID_URL = "https://carmenwiki.osu.edu/shibboleth"

# Percent-encoded form of INC_ENTITY_ID_URL above
INC_ENTITY_ID_URL_ENCODED = "https:%2F%2Fcarmenwiki.osu.edu%2Fshibboleth"

# InCommon URN-style entityID
INC_ENTITY_ID_URN = "urn:mace:incommon:internet2.edu"

0 comments on commit 5ebaca8

Please sign in to comment.
You can’t perform that action at this time.