index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2021-01-19 10:30:09 -0800 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2021-01-21 17:19:16 +1000 |
commit | b82a975e7640853fe0fde5c164ad4ad5bf64fbf7 (patch) | |
tree | 16ed05521dedcc596bac7ecd609947ff26a818e4 /test/pacman/README | |
parent | ad84a572aac455dcd3de111dbf8d66c45b20573a (diff) |
-rw-r--r-- | test/pacman/README | 23 |
diff --git a/test/pacman/README b/test/pacman/README index 224acd84..61a67d05 100644 --- a/test/pacman/README +++ b/test/pacman/README @@ -317,3 +317,26 @@ Example: pactest will ensure the file /etc/test.conf exists in the filesystem. +Serving Files +============= + +Tests can run a simple http server using the `add_simple_http_server` method, +which takes a dict with request paths for keys and their responses as values +and returns a url for the server. Responses may either be a simple string or +a dict with the following keys: `code`, `headers`, and `body`. If a value is +provided for the empty path it will be used as a fallback response for any +requests that do not match a path. + + url = self.add_simple_http_server({ + "/": "simple response", + "/custom": { + "headers": { "Content-Disposition": "attachment; filename=foo" }, + "body": ("Custom response. Code and any necessary headers " + "will by automatically set if not provided"), + } + "": { + "code": 404, + "headers": { "Content-Length": "14" }, + "body": "Page Not Found", + } + }) |