Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/testpages/README.md

Issue 29328589: Issue 3122 - Add testpages.web.sitekey_frame URL handler (Closed)
Patch Set: Created Sept. 24, 2015, 3:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # sitescripts.testpages
2
3 ## Introduction
4
5 This package contains all the dynamic URL handlers required for the otherwise
6 static testpages.adblockplus.org project. This allows us to create test cases
7 for things like sitekeys which require web responses to be generated
8 dynamically.
9
10
11 ## Usage
12
13 First create a `sitescripts.ini` file which contains the relevant options in the
14 `multiplexer` and `testpages` sections. (For an example of how these work take
15 a look at the included `.sitescripts.example.ini` file.)
16
17 Then launch the CMS test server, pointing at the `testpages.adblockplus.org`
18 repository and making sure to specify a `PYTHON_PATH` environment variable that
19 points at your copy of sitescripts. For example:
20
21 cd testpages.adblockplus.org
22 PYTHON_PATH=/path/to/sitescripts ../cms/runserver.py
23
24 For more information about the `sitescripts.ini` configuration file have a look
25 at the main documentation for this repository. For more information about
26 running the CMS test server in unison with sitescripts take a look at the
27 documentation for the CMS.
28
29 ### sitescripts.testpages.web.sitekey_frame
30
31 For test cases that test the $sitekey filter option you can use the make use of
32 the `/sitekey-frame` URL handler. The handler renders a template of your
33 choosing, passing in the public key and signature variables. For this you will
34 need to have a suitable RSA key file, a Jinja2 template that makes use of the
35 `public_key` + `signature` variables and a suitable `sitescripts.ini`
36 configuration.
37
38 Here's an example configuration:
39
40 ```
41 [multiplexer]
42 sitescripts.testpages.web.sitekey_frame =
43
44 [testpages]
45 sitekeyFrameTemplate=%(root)s/testpages.adblockplus.org/templates/sitekey_frame. tmpl
46 sitekeyPath=%(root)s/testpages.adblockplus.org/static/site.key
47 ```
48
49 The handler automatically sets the correct `X-Adblock-Key` response header but
50 it's important that the template also populates the `data-adblockkey` attribute
51 of the html element with the public key and signature. For example:
52
53 <html data-adblockkey="{{ public_key + "_" + signature }}">
OLDNEW

Powered by Google App Engine
This is Rietveld