From 97e9a2b46b11a3ddbaf6c0d0c5d2b80d1e735c40 Mon Sep 17 00:00:00 2001 From: dmartinez Date: Thu, 24 Apr 2025 12:37:02 -0700 Subject: [PATCH 1/5] Make devcontainer and update robot framework --- .devcontainer/devcontainer.json | 15 +++++++++++++++ .gitignore | 4 +--- Dockerfile | 21 +++++++++++++++++++++ MDQ.robot | 8 ++++---- md-query.robot | 6 +++--- requirements.txt | 14 +++++++------- variables.py | 14 +++++++------- 7 files changed, 58 insertions(+), 24 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile 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..56ce9bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Use the latest Python image +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 + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install the dependencies listed in requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the rest of the application code into the container +# COPY . . + +# # Specify the default command to run your app +# # (Modify "app.py" to the entry point of your application) +# CMD ["python", "app.py"] \ No newline at end of file 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/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.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" From 349accb943b06e35d2518e08003946fdb2997edc Mon Sep 17 00:00:00 2001 From: dmartinez Date: Thu, 24 Apr 2025 12:39:59 -0700 Subject: [PATCH 2/5] Fix newline --- Dockerfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 56ce9bf..ebea8b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,3 @@ COPY requirements.txt . # Install the dependencies listed in requirements.txt RUN pip install --no-cache-dir -r requirements.txt - -# Copy the rest of the application code into the container -# COPY . . - -# # Specify the default command to run your app -# # (Modify "app.py" to the entry point of your application) -# CMD ["python", "app.py"] \ No newline at end of file From 2492eff71bdaeb7aa40239d3844396eca5f65ebe Mon Sep 17 00:00:00 2001 From: dmartinez Date: Thu, 24 Apr 2025 12:41:28 -0700 Subject: [PATCH 3/5] Fix comments --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ebea8b7..90822e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# Use the latest Python image FROM python:3.13.3-slim-bullseye # Need curl for http version tests @@ -7,8 +6,6 @@ RUN apt-get update && apt-get install -y curl # Set the working directory inside the container WORKDIR /app -# Copy the requirements file into the container +# Install the dependencies for robot framework COPY requirements.txt . - -# Install the dependencies listed in requirements.txt RUN pip install --no-cache-dir -r requirements.txt From 0a81d2a63e52f9955e46621f37019bbeac19f5cf Mon Sep 17 00:00:00 2001 From: dmartinez Date: Thu, 24 Apr 2025 13:29:57 -0700 Subject: [PATCH 4/5] Update README --- README.md | 31 +++++++++++-------------------- variables-dev.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 variables-dev.py diff --git a/README.md b/README.md index 151d3bc..ea96c1a 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 dev-variables.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/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" From 6bbe67fee971eaca4132b320614dcca05e98c097 Mon Sep 17 00:00:00 2001 From: dmartinez Date: Thu, 24 Apr 2025 13:30:50 -0700 Subject: [PATCH 5/5] Fix filename --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea96c1a..952078d 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Once inside the devcontainer, use the terminal to run the tests. Here is a list - Read variables from another file ```sh - robot --variablefile dev-variables.py . + robot --variablefile variables-dev.py . ``` - Skip downloading and parsing the complete aggregate