123 |
123 |
app = login(TestApp(application))
|
124 |
124 |
|
125 |
125 |
# get matomo's validation page
|
126 |
|
resp1 = app.get('/visits-tracking/enable-manual', status=200)
|
127 |
|
assert re.search('<textarea.* name="tracking_js"', resp1.body)
|
|
126 |
resp = app.get('/visits-tracking/enable-manual', status=200)
|
|
127 |
assert re.search('<textarea.* name="tracking_js"', resp.body)
|
128 |
128 |
|
129 |
129 |
# validate and get matomo's home page
|
130 |
|
resp1.form['tracking_js'] = '...js_code_1...'
|
131 |
|
resp2 = resp1.form.submit().follow()
|
132 |
|
assert resp2.body.find('Manual configuration.')
|
133 |
|
assert re.search('<textarea.* name="tracking_js"', resp2.body)
|
134 |
|
assert resp2.body.find('...js_code_1...</textarea>') != -1
|
135 |
|
assert resp2.body.find('<button class="submit-button">Save</button>') != -1
|
|
130 |
resp.form['tracking_js'] = '...js_code_1...'
|
|
131 |
resp = resp.form.submit().follow()
|
|
132 |
assert resp.body.find('Manual configuration.')
|
|
133 |
assert re.search('<textarea.* name="tracking_js"', resp.body)
|
|
134 |
assert resp.body.find('...js_code_1...</textarea>') != -1
|
|
135 |
assert resp.body.find('<button class="submit-button">Save</button>') != -1
|
136 |
136 |
|
137 |
137 |
# update JS code on matomo's home page
|
138 |
|
resp2.form['tracking_js'] = '...js_code_2...'
|
139 |
|
resp3 = resp2.form.submit().follow()
|
140 |
|
assert resp3.body.find('Manual configuration.') != -1
|
141 |
|
assert re.search('<textarea.* name="tracking_js"', resp3.body)
|
142 |
|
assert resp3.body.find('...js_code_2...</textarea>') != -1
|
143 |
|
assert resp3.body.find('<button class="submit-button">Save</button>') != -1
|
144 |
|
assert resp3.body.find('Good respect of user rights') != -1
|
|
138 |
resp.form['tracking_js'] = '...js_code_2...'
|
|
139 |
resp = resp.form.submit().follow()
|
|
140 |
assert resp.body.find('Manual configuration.') != -1
|
|
141 |
assert re.search('<textarea.* name="tracking_js"', resp.body)
|
|
142 |
assert resp.body.find('...js_code_2...</textarea>') != -1
|
|
143 |
assert resp.body.find('<button class="submit-button">Save</button>') != -1
|
|
144 |
assert resp.body.find('Good respect of user rights') != -1
|
|
145 |
|
|
146 |
# check html tags
|
|
147 |
resp.form['tracking_js'] = '<script>...js_code_2...</script>'
|
|
148 |
resp = resp.form.submit()
|
|
149 |
assert '<ul class="errorlist"><li>Remove html tags.</li></ul>' in resp.text
|
|
150 |
resp.form['tracking_js'] = '<script >'
|
|
151 |
resp = resp.form.submit()
|
|
152 |
assert '<ul class="errorlist"><li>Remove html tags.</li></ul>' in resp.text
|
|
153 |
|
145 |
154 |
|
146 |
155 |
def test_available_options(admin_user):
|
147 |
156 |
"""check available buttons (manual/automatic configurations)"""
|
148 |
|
-
|