-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathtest_view_home.py
More file actions
34 lines (22 loc) · 866 Bytes
/
test_view_home.py
File metadata and controls
34 lines (22 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest
from django.urls import reverse
@pytest.fixture
def home_resp(client):
return _resp(client)
def _resp(client):
"""Plain function to avoid _pytest.warning_types.RemovedInPytest4Warning: Fixture "resp" called directly."""
return client.get('/')
def test_home_status_code(home_resp):
assert home_resp.status_code == 302
assert home_resp.url == reverse('dashboard:home')
def test_thanks_status_code(client):
resp = client.get(reverse('core:thanks'))
assert 200 == resp.status_code
@pytest.fixture
def home_resp_open_subscriptions(client, mocker):
mocker.patch('pythonpro.core.views.is_launch_open', return_value=True)
return _resp(client)
@pytest.fixture
def home_resp_closed_subscriptions(client, mocker):
mocker.patch('pythonpro.core.views.is_launch_open', return_value=False)
return _resp(client)