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

tests.integration.blueprints.common.style_guide.test_style_guide   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 6

5 Functions

Rating   Name   Duplication   Size   Complexity  
A assert_response_status_code() 0 5 2
A test_site_style_guide_when_disabled() 0 2 1
A test_admin_style_guide_when_enabled() 0 3 1
A test_admin_style_guide_when_disabled() 0 2 1
A test_site_style_guide_when_enabled() 0 3 1
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