misc: rename /matomo/ section to /visits-tracking/ (#38671)
This commit is contained in:
parent
23c5530f68
commit
fa8b459c50
|
@ -36,7 +36,7 @@ urlpatterns = [
|
|||
url(r'^sites/', decorated_includes(admin_required, include(environment_urls))),
|
||||
url(r'^profile/', decorated_includes(admin_required, include(profile_urls))),
|
||||
url(r'^franceconnect/', decorated_includes(admin_required, include(franceconnect_urls))),
|
||||
url(r'^matomo/', decorated_includes(admin_required, include(matomo_urls))),
|
||||
url(r'^visits-tracking/', decorated_includes(admin_required, include(matomo_urls))),
|
||||
url(r'^theme/', decorated_includes(admin_required, include(theme_urls))),
|
||||
url(r'^emails/', decorated_includes(admin_required, include(emails_urls))),
|
||||
url(r'^debug/', decorated_includes(admin_required, include(debug_urls))),
|
||||
|
|
|
@ -105,25 +105,25 @@ def login(app, username='admin', password='admin'):
|
|||
def test_unlogged_access():
|
||||
# connect while not being logged in
|
||||
app = TestApp(application)
|
||||
resp = app.get('/matomo/', status=302)
|
||||
assert resp.location.endswith('/login/?next=/matomo/')
|
||||
resp = app.get('/visits-tracking/', status=302)
|
||||
assert resp.location.endswith('/login/?next=/visits-tracking/')
|
||||
|
||||
def test_access(admin_user):
|
||||
app = login(TestApp(application))
|
||||
assert app.get('/matomo/', status=200)
|
||||
assert app.get('/visits-tracking/', status=200)
|
||||
|
||||
def test_disable(admin_user):
|
||||
app = login(TestApp(application))
|
||||
resp1 = app.get('/matomo/disable', status=200)
|
||||
resp1 = app.get('/visits-tracking/disable', status=200)
|
||||
resp2 = resp1.form.submit()
|
||||
assert resp2.location.endswith('/matomo/')
|
||||
assert resp2.location.endswith('/visits-tracking/')
|
||||
|
||||
def test_enable_manual(admin_user):
|
||||
"""scenario where user manually paste a javascript code"""
|
||||
app = login(TestApp(application))
|
||||
|
||||
# get matomo's validation page
|
||||
resp1 = app.get('/matomo/enable-manual', status=200)
|
||||
resp1 = app.get('/visits-tracking/enable-manual', status=200)
|
||||
assert re.search('<textarea.* name="tracking_js"', resp1.body)
|
||||
|
||||
# validate and get matomo's home page
|
||||
|
@ -147,15 +147,15 @@ def test_available_options(admin_user):
|
|||
"""check available buttons (manual/automatic configurations)"""
|
||||
with override_settings(MATOMO_SERVER=CONFIG):
|
||||
app = login(TestApp(application))
|
||||
resp = app.get('/matomo/', status=200)
|
||||
assert str(resp).find('href="/matomo/enable-manual"') != -1
|
||||
assert str(resp).find('href="/matomo/enable-auto"') != -1
|
||||
resp = app.get('/visits-tracking/', status=200)
|
||||
assert str(resp).find('href="/visits-tracking/enable-manual"') != -1
|
||||
assert str(resp).find('href="/visits-tracking/enable-auto"') != -1
|
||||
|
||||
# without configuration: no automatic configuration available
|
||||
app = login(TestApp(application))
|
||||
resp = app.get('/matomo/', status=200)
|
||||
assert str(resp).find('href="/matomo/enable-manual"') != -1
|
||||
assert str(resp).find('href="/matomo/enable-auto"') == -1
|
||||
resp = app.get('/visits-tracking/', status=200)
|
||||
assert str(resp).find('href="/visits-tracking/enable-manual"') != -1
|
||||
assert str(resp).find('href="/visits-tracking/enable-auto"') == -1
|
||||
|
||||
@mock.patch('requests.post')
|
||||
def test_enable_auto(mocked_post, admin_user):
|
||||
|
@ -172,7 +172,7 @@ def test_enable_auto(mocked_post, admin_user):
|
|||
mocked_post.side_effect = requests_post_mocked_replies(contents)
|
||||
with override_settings(MATOMO_SERVER=CONFIG):
|
||||
app = login(TestApp(application))
|
||||
resp1 = app.get('/matomo/enable-auto', status=200)
|
||||
resp1 = app.get('/visits-tracking/enable-auto', status=200)
|
||||
resp2 = resp1.form.submit()
|
||||
|
||||
# call utils.py::auto_configure_matomo()
|
||||
|
@ -196,7 +196,7 @@ def test_enable_auto_warning(mocked_post, admin_user):
|
|||
mocked_post.side_effect = requests_post_mocked_replies(contents)
|
||||
with override_settings(MATOMO_SERVER=CONFIG):
|
||||
app = login(TestApp(application))
|
||||
resp1 = app.get('/matomo/enable-auto', status=200)
|
||||
resp1 = app.get('/visits-tracking/enable-auto', status=200)
|
||||
resp2 = resp1.form.submit()
|
||||
|
||||
# call utils.py::auto_configure_matomo()
|
||||
|
@ -223,7 +223,7 @@ def test_enable_auto_error(mocked_post, admin_user):
|
|||
mocked_post.side_effect = requests_post_mocked_replies(contents)
|
||||
with override_settings(MATOMO_SERVER=CONFIG):
|
||||
app = login(TestApp(application))
|
||||
resp1 = app.get('/matomo/enable-auto', status=200)
|
||||
resp1 = app.get('/visits-tracking/enable-auto', status=200)
|
||||
resp2 = resp1.form.submit()
|
||||
|
||||
# call utils.py::auto_configure_matomo()
|
||||
|
|
Loading…
Reference in New Issue