Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
80 lines (68 sloc) 4.29 KB
# 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.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
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
Should Contain ${Curl.stdout} 200 OK msg=MAY support HTTP versions later than 1.1
2.5 Response Headers (Required)
# Content-Encoding
${resp}= Get Entity With Gzip baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-encoding msg=MUST return Content-Encoding header if compressed
# Content-Type
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-type msg=MUST return Content-Type header
# ETag
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${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 Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header
# Content-Length
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} content-length msg=SHOULD return Content-Length header
# Last-Modified
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Dictionary Should Contain Key ${resp.headers} last-modified msg=SHOULD return Last-Modified header
4.1 Conditional Retrieval
[Tags] optional
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
${etag}= Get From Dictionary ${resp.headers} ETag
${resp}= Conditional Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED} etag=${etag}
Should Be Equal As Strings ${resp.status_code} 304 msg=SHOULD return HTTP status code 304
4.2 Content Caching
[Tags] optional
# "Responders SHOULD include cache control information with successful
# (200 status code) responses, assuming the responder knows when
# retrieved metadata is meant to expire."
${resp}= Get Entity baseUrl=${BASE_URL} identifier=${ENTITY_ID_ENCODED}
Should Be Equal As Strings ${resp.status_code} 200
Dictionary Should Contain Key ${resp.headers} cache-control msg=SHOULD return Cache-Control header with Success response
# "When cache controls are used only the 'max-age' directive SHOULD be used."
${directive}= Get From Dictionary ${resp.headers} cache-control
Should Start With ${directive} max-age= msg=Only the 'max-age' directive SHOULD be used
# "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
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
Should Start With ${directive} max-age= msg=Only the 'max-age' directive SHOULD be used
4.3 Content Compression
${resp}= Get Entity With Gzip baseUrl=${BASE_URL} identifier=${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
You can’t perform that action at this time.