Skip to content

TIDO-550 Update testing framework #7

Merged
merged 5 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"build": {
"dockerfile": "../Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"d-biehl.robotcode"
]
}
},
"postCreateCommand": "echo alias robot=\\'robot --outputdir output\\' >> ~/.bashrc",
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind",
"workspaceFolder": "/app"
}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
*.pyc
__pycache__
.DS_Store
log.html
output.xml
output/
pip-selfcheck.json
report.html
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.13.3-slim-bullseye

# Need curl for http version tests
RUN apt-get update && apt-get install -y curl

# Set the working directory inside the container
WORKDIR /app

# Install the dependencies for robot framework
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
8 changes: 4 additions & 4 deletions MDQ.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ Get All Entities
[Arguments] ${baseUrl}
Create Session md ${baseUrl}
${resp}= GET On Session md /entities
[Return] ${resp}
RETURN ${resp}

Get Entity
[Arguments] ${baseUrl} ${identifier} ${expectedStatus}=200
Create Session md ${baseUrl}
${resp}= GET On Session md /entities/${identifier} expected_status=${expectedStatus}
[Return] ${resp}
RETURN ${resp}

Get Entity With Gzip
[Arguments] ${baseUrl} ${identifier}
Create Session md ${baseUrl}
&{headers}= Create Dictionary Accept-Encoding=gzip
${resp}= GET On Session md /entities/${identifier} headers=${headers}
[Return] ${resp}
RETURN ${resp}

Conditional Get Entity
[Arguments] ${baseUrl} ${identifier} ${etag}
&{headers}= Create Dictionary If-None-Match=${etag}
Create Session md ${baseUrl}
${resp}= GET On Session md /entities/${identifier} headers=${headers}
[Return] ${resp}
RETURN ${resp}
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,28 @@ See also:
git clone https://github.internet2.edu/internet2/md-query-saml-uat.git
```

2. Create and activate a new Python virtual environment:
2. Running the devcontainer will set up all things needed in the container environment to run the tests

```sh
python3 -m venv .venv && source .venv/bin/activate
```
## Usage

3. Install dependencies:
Once inside the devcontainer, use the terminal to run the tests. Here is a list of commands:
- Run all tests in the current directory (skipping failures in any tests tagged as "optional")

```sh
pip install -r requirements.txt
robot --skiponfailure optional .
```

4. Run all tests in the current directory, skipping failures in any tests tagged as "optional":
- Read variables from another file

```sh
robot --skiponfailure optional .
robot --variablefile variables-dev.py .
```

## Usage
- Skip downloading and parsing the complete aggregate

Read variables from another file:

```sh
robot --variablefile dev-variables.py .
```

Skip downloading and parsing the complete aggregate:

```sh
robot --exclude aggregate .
```
```sh
robot --exclude aggregate .
```

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions md-query.robot
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Variables variables.py
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.1 -i ${BASE_URL}/entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
${Curl} Run Process /usr/bin/curl -s --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 --http1.0 -i ${BASE_URL}/entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
${Curl} Run Process /usr/bin/curl -s --http1.0 -i ${BASE_URL}/entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
Should Contain ${Curl.stdout} 505 msg=MUST NOT support HTTP versions prior to 1.1

${Curl} Run Process /usr/bin/curl --http2 -i ${BASE_URL}/entities/${ENTITY_ID_ENCODED} |head -n 1 shell=true
${Curl} Run Process /usr/bin/curl -s --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)
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
certifi==2021.10.8
charset-normalizer==2.0.12
idna==3.3
requests==2.27.1
robotframework==5.0
robotframework-requests==0.9.2
urllib3==1.26.9
certifi==2025.1.31
charset-normalizer==3.4.1
idna==3.10
requests==2.32.3
robotframework==7.2.2
robotframework-requests==0.9.7
urllib3==2.4.0
29 changes: 29 additions & 0 deletions variables-dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Base Metadata Query server URL
BASE_URL = "http://mdq-dev.ti.internet2.edu"

# Any known existing entityID
ENTITY_ID = "https://login.at.internet2.edu/Saml2/proxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above
ENTITY_ID_ENCODED = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above using uppercase percent-encoding
ENTITY_ID_ENCODED_UPPERCASE = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above using lowercase percent-encoding
ENTITY_ID_ENCODED_LOWERCASE = "https:%2f%2flogin.at.internet2.edu%2fSaml2%2fproxy_saml2_backend.xml"

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

# InCommon URL-style entityID
INC_ENTITY_ID_URL = "https://login.at.internet2.edu/Saml2/proxy_saml2_backend.xml"

# Percent-encoded form of INC_ENTITY_ID_URL above
INC_ENTITY_ID_URL_ENCODED = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

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

# InCommon collection of all IdPs
INC_ALL_IDPS = "idps/all"
14 changes: 7 additions & 7 deletions variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
BASE_URL = "http://mdq.incommon.org"

# Any known existing entityID
ENTITY_ID = "https://fm.incommon.org/sp"
ENTITY_ID = "https://login.at.internet2.edu/Saml2/proxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above
ENTITY_ID_ENCODED = "https:%2F%2Ffm.incommon.org%2Fsp"
ENTITY_ID_ENCODED = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above using uppercase percent-encoding
ENTITY_ID_ENCODED_UPPERCASE = "https:%2F%2Ffm.incommon.org%2Fsp"
ENTITY_ID_ENCODED_UPPERCASE = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

# Percent-encoded form of ENTITY_ID above using lowercase percent-encoding
ENTITY_ID_ENCODED_LOWERCASE = "https:%2f%2ffm.incommon.org%2fsp"
ENTITY_ID_ENCODED_LOWERCASE = "https:%2f%2flogin.at.internet2.edu%2fSaml2%2fproxy_saml2_backend.xml"

# SHA-1 transformed form of ENTITY_ID above
ENTITY_ID_SHA1 = "20f0fe93f679ac8a2ddcf0822ecdec007c56546f"
ENTITY_ID_SHA1 = "e7c92201d85ed38c817ebe3a63866fd948f22d14"

# InCommon URL-style entityID
INC_ENTITY_ID_URL = "https://fm.incommon.org/sp"
INC_ENTITY_ID_URL = "https://login.at.internet2.edu/Saml2/proxy_saml2_backend.xml"

# Percent-encoded form of INC_ENTITY_ID_URL above
INC_ENTITY_ID_URL_ENCODED = "https:%2F%2Ffm.incommon.org%2Fsp"
INC_ENTITY_ID_URL_ENCODED = "https:%2F%2Flogin.at.internet2.edu%2FSaml2%2Fproxy_saml2_backend.xml"

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