Passed
Push — main ( 3dfea1...9fd59f )
by Jochen
04:08
created

test_site_style_guide_when_enabled()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
"""
2
:Copyright: 2006-2021 Jochen Kupperschmidt
3
:License: Revised BSD (see `LICENSE` file for details)
4
"""
5
6
import pytest
7
8
from tests.helpers import http_client
9
10
11
URL_PATH = '/style_guide/'
12
13
14
# `admin_app` fixture is required because it sets up the database.
15
def test_admin_style_guide_when_enabled(admin_app, make_admin_app):
16
    debug_admin_app = make_admin_app(STYLE_GUIDE_ENABLED=True)
17
    assert_response_status_code(debug_admin_app, 200)
18
19
20
def test_admin_style_guide_when_disabled(admin_app):
21
    assert_response_status_code(admin_app, 404)
22
23
24
def test_site_style_guide_when_enabled(make_site_app, site):
25
    debug_site_app = make_site_app(STYLE_GUIDE_ENABLED=True)
26
    assert_response_status_code(debug_site_app, 200)
27
28
29
def test_site_style_guide_when_disabled(site_app, site):
30
    assert_response_status_code(site_app, 404)
31
32
33
# helpers
34
35
36
def assert_response_status_code(app, expected_status_code):
37
    with http_client(app) as client:
38
        response = client.get(URL_PATH)
39
40
    assert response.status_code == expected_status_code
41