diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6852f12 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" +} diff --git a/.gitignore b/.gitignore index 7cf0dec..465a872 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *.pyc __pycache__ .DS_Store -log.html -output.xml +output/ pip-selfcheck.json -report.html diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..90822e3 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/MDQ.robot b/MDQ.robot index a18763a..a051aa3 100644 --- a/MDQ.robot +++ b/MDQ.robot @@ -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} diff --git a/README.md b/README.md index 151d3bc..952078d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/md-query.robot b/md-query.robot index 7b5cc4e..6b0c41d 100644 --- a/md-query.robot +++ b/md-query.robot @@ -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) diff --git a/requirements.txt b/requirements.txt index b256bbc..aca2829 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/variables-dev.py b/variables-dev.py new file mode 100644 index 0000000..5a34b6f --- /dev/null +++ b/variables-dev.py @@ -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" diff --git a/variables.py b/variables.py index a1aa1bc..b4646a2 100644 --- a/variables.py +++ b/variables.py @@ -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"