Skip to content

Commit

Permalink
Removed root redirect
Browse files Browse the repository at this point in the history
close #4862
  • Loading branch information
renzo authored and renzon committed Feb 29, 2024
1 parent faf45fc commit f6fcfee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
21 changes: 2 additions & 19 deletions pythonpro/core/tests/test_view_home.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import pytest
from django.test import Client
from django.urls import reverse
from model_bakery import baker


@pytest.fixture
Expand All @@ -14,31 +12,16 @@ def _resp(client):
return client.get('/')


@pytest.fixture
def home_resp_with_user(django_user_model, client: Client, settings):
settings.DISCOURSE_BASE_URL = 'https://forum.python.pro.br/'
user = baker.make(django_user_model)
client.force_login(user)
return _resp(client)


def test_home_status_code(home_resp):
assert 302 == home_resp.status_code
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


def test_redirec_to_dashboard(home_resp_with_user):
"""
Assert User is redirected to dashboard
"""
assert home_resp_with_user.status_code == 302
assert home_resp_with_user.url == reverse('dashboard:home')


@pytest.fixture
def home_resp_open_subscriptions(client, mocker):
mocker.patch('pythonpro.core.views.is_launch_open', return_value=True)
Expand Down
4 changes: 1 addition & 3 deletions pythonpro/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@


def index(request):
if request.user.is_authenticated:
return redirect(reverse('dashboard:home'))
return redirect('https://pythonpro.com.br')
return redirect(reverse('dashboard:home'))


def thanks(request):
Expand Down

0 comments on commit f6fcfee

Please sign in to comment.