File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pytest
2- from django .test import Client
32from django .urls import reverse
4- from model_bakery import baker
53
64
75@pytest .fixture
@@ -14,31 +12,16 @@ def _resp(client):
1412 return client .get ('/' )
1513
1614
17- @pytest .fixture
18- def home_resp_with_user (django_user_model , client : Client , settings ):
19- settings .DISCOURSE_BASE_URL = 'https://forum.python.pro.br/'
20- user = baker .make (django_user_model )
21- client .force_login (user )
22- return _resp (client )
23-
24-
2515def test_home_status_code (home_resp ):
26- assert 302 == home_resp .status_code
16+ assert home_resp .status_code == 302
17+ assert home_resp .url == reverse ('dashboard:home' )
2718
2819
2920def test_thanks_status_code (client ):
3021 resp = client .get (reverse ('core:thanks' ))
3122 assert 200 == resp .status_code
3223
3324
34- def test_redirec_to_dashboard (home_resp_with_user ):
35- """
36- Assert User is redirected to dashboard
37- """
38- assert home_resp_with_user .status_code == 302
39- assert home_resp_with_user .url == reverse ('dashboard:home' )
40-
41-
4225@pytest .fixture
4326def home_resp_open_subscriptions (client , mocker ):
4427 mocker .patch ('pythonpro.core.views.is_launch_open' , return_value = True )
Original file line number Diff line number Diff line change 2424
2525
2626def index (request ):
27- if request .user .is_authenticated :
28- return redirect (reverse ('dashboard:home' ))
29- return redirect ('https://pythonpro.com.br' )
27+ return redirect (reverse ('dashboard:home' ))
3028
3129
3230def thanks (request ):
You can’t perform that action at this time.
0 commit comments