From e6fcb9ce8eabe900ed3b53b651244167d9a96d95 Mon Sep 17 00:00:00 2001 From: David Shafer Date: Mon, 4 Apr 2022 11:29:45 -0500 Subject: [PATCH] TIDO-347 Upgrade robot framework --- MDQ.robot | 20 ++++++++++---------- README.md | 44 +++++++++++++++++++++----------------------- md-query-saml.robot | 3 +-- md-query.robot | 3 +-- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/MDQ.robot b/MDQ.robot index 4115fc5..a18763a 100644 --- a/MDQ.robot +++ b/MDQ.robot @@ -4,26 +4,26 @@ Library RequestsLibrary *** Keywords *** Get All Entities [Arguments] ${baseUrl} - Create Session alias=md url=${baseUrl} - ${resp}= Get Request alias=md uri=entities + Create Session md ${baseUrl} + ${resp}= GET On Session md /entities [Return] ${resp} Get Entity - [Arguments] ${baseUrl} ${identifier} - Create Session alias=md url=${baseUrl} - ${resp}= Get Request alias=md uri=/entities/${identifier} + [Arguments] ${baseUrl} ${identifier} ${expectedStatus}=200 + Create Session md ${baseUrl} + ${resp}= GET On Session md /entities/${identifier} expected_status=${expectedStatus} [Return] ${resp} Get Entity With Gzip [Arguments] ${baseUrl} ${identifier} - Create Session alias=md url=${baseUrl} - &{headers}= Create Dictionary Accept-Encoding=gzip - ${resp}= Get Request alias=md uri=entities/${identifier} headers=${headers} + Create Session md ${baseUrl} + &{headers}= Create Dictionary Accept-Encoding=gzip + ${resp}= GET On Session md /entities/${identifier} headers=${headers} [Return] ${resp} Conditional Get Entity [Arguments] ${baseUrl} ${identifier} ${etag} &{headers}= Create Dictionary If-None-Match=${etag} - Create Session alias=md url=${baseUrl} - ${resp}= Get Request alias=md uri=/entities/${identifier} headers=${headers} + Create Session md ${baseUrl} + ${resp}= GET On Session md /entities/${identifier} headers=${headers} [Return] ${resp} diff --git a/README.md b/README.md index 09f173e..bbb5d30 100644 --- a/README.md +++ b/README.md @@ -11,48 +11,46 @@ See also: ## Getting Started -1. Install Robot Framework (see https://github.com/robotframework/robotframework/blob/master/INSTALL.rst) +1. Clone this repository: -2. Install Requests library: `pip install robotframework-requests` + ```sh + git clone https://github.internet2.edu/internet2/md-query-saml-uat.git + ``` -3. Clone this repository: - ``` - git clone https://github.internet2.edu/internet2/md-query-saml-uat.git - ``` +2. Copy `variables.py.example` to `variables.py`: -4. Copy `variables.py.example` to `variables.py`: `cp variables.py.example variables.py` + ```sh + cp variables.py.example variables.py + ``` -5. Edit `variables.py` for your environment. +3. Edit `variables.py` for your environment. -6. Run the test suite: - ``` - robot --noncritical optional . - ``` +4. Run the test suite: + ```sh + robot --noncritical optional . + ``` ## Usage Run all test cases in the current directory: -``` + +```sh robot . ``` Treat any test cases tagged with `optional` as noncritical: -``` -robot --noncritical optional . + +```sh +robot --skiponfailure optional . ``` Additionally skip long-running test cases (those that download and parse all entities): -``` -robot --noncritical optional --exclude aggregate . -``` - - -## To Do - -1. Isolate Python dependencies with `virtualenv` or similar. +```sh +robot --skiponfailure optional --exclude aggregate . +``` ## Contributing diff --git a/md-query-saml.robot b/md-query-saml.robot index f95c071..4ed9b95 100644 --- a/md-query-saml.robot +++ b/md-query-saml.robot @@ -17,8 +17,7 @@ Variables variables.py 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 Entity baseUrl=${BASE_URL} identifier=foo - Should Be Equal As Strings ${resp.status_code} 404 msg=MUST return HTTP status code 404 + ${resp}= Get Entity baseUrl=${BASE_URL} identifier=foo expectedStatus=404 3.1.2 One Entity Descriptor Returned ${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED} diff --git a/md-query.robot b/md-query.robot index 6b68c3c..7b5cc4e 100644 --- a/md-query.robot +++ b/md-query.robot @@ -67,8 +67,7 @@ Variables variables.py # "The responder SHOULD also include cache control information with 404 Not # Found responses. This allows the requester to create and maintain a # negative-response cache." - ${resp}= Get Entity baseUrl=${BASE_URL} identifier=foo - Should Be Equal As Strings ${resp.status_code} 404 + ${resp}= Get Entity baseUrl=${BASE_URL} identifier=foo expectedStatus=404 Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header with Not Found response # "When cache controls are used only the 'max-age' directive SHOULD be used." ${directive}= Get From Dictionary ${resp.headers} cache-control