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

Delta Between Two Patch Sets: sitescripts/testpages/README.md

Issue 29328589: Issue 3122 - Add testpages.web.sitekey_frame URL handler (Closed)
Left Patch Set: Created Sept. 24, 2015, 3:45 p.m.
Right Patch Set: Further improvements Created Oct. 8, 2015, noon
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 # sitescripts.testpages 1 # sitescripts.testpages
2 2
3 ## Introduction 3 ## Introduction
4 4
5 This package contains all the dynamic URL handlers required for the otherwise 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 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 7 for things like sitekeys which require web responses to be generated
8 dynamically. 8 dynamically.
9 9
10 10
11 ## Usage 11 ## sitescripts.testpages.web.sitekey_frame
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 12
31 For test cases that test the $sitekey filter option you can use the make use of 13 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 14 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 15 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 16 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` 17 `public_key` + `signature` variables and a suitable `sitescripts.ini`
36 configuration. 18 configuration.
37 19
38 Here's an example configuration: 20 Here's an example configuration:
39 21
40 ``` 22 ```
41 [multiplexer] 23 [multiplexer]
42 sitescripts.testpages.web.sitekey_frame = 24 sitescripts.testpages.web.sitekey_frame =
43 25
44 [testpages] 26 [testpages]
45 sitekeyFrameTemplate=%(root)s/testpages.adblockplus.org/templates/sitekey_frame. tmpl 27 sitekeyFrameTemplate=%(root)s/testpages.adblockplus.org/templates/sitekey_frame. tmpl
46 sitekeyPath=%(root)s/testpages.adblockplus.org/static/site.key 28 sitekeyPath=%(root)s/testpages.adblockplus.org/static/site.key
47 ``` 29 ```
48 30
49 The handler automatically sets the correct `X-Adblock-Key` response header but 31 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 32 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: 33 of the html element with the public key and signature. For example:
52 34
53 <html data-adblockkey="{{ public_key + "_" + signature }}"> 35 <html data-adblockkey="{{ public_key + "_" + signature }}">
LEFTRIGHT

Powered by Google App Engine
This is Rietveld