| Index: sitescripts/testpages/README.md |
| diff --git a/sitescripts/testpages/README.md b/sitescripts/testpages/README.md |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..24fce7da995b24a0ae9d65f199f0b427e515a47c |
| --- /dev/null |
| +++ b/sitescripts/testpages/README.md |
| @@ -0,0 +1,53 @@ |
| +# sitescripts.testpages |
| + |
| +## Introduction |
| + |
| +This package contains all the dynamic URL handlers required for the otherwise |
| +static testpages.adblockplus.org project. This allows us to create test cases |
| +for things like sitekeys which require web responses to be generated |
| +dynamically. |
| + |
| + |
| +## Usage |
| + |
| +First create a `sitescripts.ini` file which contains the relevant options in the |
| +`multiplexer` and `testpages` sections. (For an example of how these work take |
| +a look at the included `.sitescripts.example.ini` file.) |
| + |
| +Then launch the CMS test server, pointing at the `testpages.adblockplus.org` |
| +repository and making sure to specify a `PYTHON_PATH` environment variable that |
| +points at your copy of sitescripts. For example: |
| + |
| + cd testpages.adblockplus.org |
| + PYTHON_PATH=/path/to/sitescripts ../cms/runserver.py |
| + |
| +For more information about the `sitescripts.ini` configuration file have a look |
| +at the main documentation for this repository. For more information about |
| +running the CMS test server in unison with sitescripts take a look at the |
| +documentation for the CMS. |
| + |
| +### sitescripts.testpages.web.sitekey_frame |
| + |
| +For test cases that test the $sitekey filter option you can use the make use of |
| +the `/sitekey-frame` URL handler. The handler renders a template of your |
| +choosing, passing in the public key and signature variables. For this you will |
| +need to have a suitable RSA key file, a Jinja2 template that makes use of the |
| +`public_key` + `signature` variables and a suitable `sitescripts.ini` |
| +configuration. |
| + |
| +Here's an example configuration: |
| + |
| +``` |
| +[multiplexer] |
| +sitescripts.testpages.web.sitekey_frame = |
| + |
| +[testpages] |
| +sitekeyFrameTemplate=%(root)s/testpages.adblockplus.org/templates/sitekey_frame.tmpl |
| +sitekeyPath=%(root)s/testpages.adblockplus.org/static/site.key |
| +``` |
| + |
| +The handler automatically sets the correct `X-Adblock-Key` response header but |
| +it's important that the template also populates the `data-adblockkey` attribute |
| +of the html element with the public key and signature. For example: |
| + |
| + <html data-adblockkey="{{ public_key + "_" + signature }}"> |