Fix further problems with middleware ordering

This commit is contained in:
Raphael Michel
2020-01-29 11:50:09 +01:00
parent a940fa9eb7
commit a28378bac9
3 changed files with 16 additions and 1 deletions

View File

@@ -189,3 +189,11 @@ def test_metrics_view(monkeypatch, client):
# test metrics-view
basic_auth = {"HTTP_AUTHORIZATION": base64.b64encode(bytes("foo:bar", "utf-8"))}
assert "{} {}".format(fullname, counter_value) not in client.get("/metrics", headers=basic_auth)
@pytest.mark.django_db
@override_settings(HAS_REDIS=True, METRICS_USER="foo", METRICS_PASSPHRASE="bar")
def test_do_not_break_append_slash(monkeypatch, client):
r = client.get('/control')
assert r.status_code == 301
assert r['Location'] == '/control/'

View File

@@ -27,6 +27,13 @@ def test_control_only_on_main_domain(env, client):
assert r['Location'] == 'http://example.com/control/login'
@pytest.mark.django_db
def test_append_slash(env, client):
r = client.get('/control')
assert r.status_code == 301
assert r['Location'] == '/control/'
@pytest.mark.django_db
def test_unknown_domain(env, client):
r = client.get('/control/login', HTTP_HOST='foobar')