Skip to content

Commit 46f6983

Browse files
renzonrenzon
authored andcommitted
Redirected user already registered to dashboard
close #2567
1 parent 6fec0a8 commit 46f6983

File tree

61 files changed

+194
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+194
-231
lines changed

conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,12 @@ def turn_active_campaign_on(settings):
7171
settings.ACTIVE_CAMPAIGN_TURNED_ON = True
7272

7373

74+
@pytest.fixture(autouse=True)
75+
def turn_ssl_rediret_off_for_tests(settings):
76+
"""
77+
There is no need to place secure=True in all client requests
78+
"""
79+
settings.SECURE_SSL_REDIRECT = False
80+
81+
7482
pytest_plugins = ['pythonpro.modules.tests.test_topics_view']

pythonpro/analytics/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@pytest.fixture
1111
def pre_request():
1212
factory = RequestFactory()
13-
request = factory.get('/', secure=True)
13+
request = factory.get('/')
1414
request.user = AnonymousUser()
1515
return request
1616

pythonpro/analytics/tests/test_middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def mocked_get_or_create_session(mocked_request_with_analytics, mocker):
1818
def test_should_execute_get_or_create_session(client,
1919
mocked_get_or_create_session):
2020

21-
client.get('/', secure=True)
21+
client.get('/')
2222
assert mocked_get_or_create_session.called
2323

2424

@@ -32,12 +32,12 @@ def mocked_create_pageview(mocked_request_with_analytics, mocker):
3232
def test_should_execute_create_pageview(client, mocked_get_or_create_session,
3333
mocked_create_pageview):
3434

35-
client.get('/', secure=True)
35+
client.get('/')
3636
assert mocked_create_pageview.called
3737

3838

3939
@pytest.mark.django_db
4040
def test_should_run_full_process(client):
41-
client.get('/curso-de-python-gratis', secure=True)
41+
client.get('/curso-de-python-gratis')
4242
assert UserSession.objects.get()
4343
assert PageView.objects.get()

pythonpro/checkout/tests/test_landing_page_webdev.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@pytest.fixture
77
def resp(client_with_lead, db):
8-
return client_with_lead.get(reverse('checkout:webdev_landing_page'), secure=True)
8+
return client_with_lead.get(reverse('checkout:webdev_landing_page'))
99

1010

1111
def test_should_page_exists(resp):

pythonpro/checkout/tests/test_landing_page_webdev_50_off.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@pytest.fixture
77
def resp(client_with_lead, db):
8-
return client_with_lead.get(reverse('checkout:webdev_landing_page_50_off'), secure=True)
8+
return client_with_lead.get(reverse('checkout:webdev_landing_page_50_off'))
99

1010

1111
def test_should_page_exists(resp):

pythonpro/checkout/tests/test_landing_page_webdev_oto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@pytest.fixture
77
def resp(client_with_lead, db):
8-
return client_with_lead.get(reverse('checkout:webdev_landing_page_oto'), secure=True)
8+
return client_with_lead.get(reverse('checkout:webdev_landing_page_oto'))
99

1010

1111
def test_should_page_exists(resp):

pythonpro/checkout/tests/test_membership_lp_when_subscription_closed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def tag_as_mock(mocker):
1616
def resp(client, tag_as_mock, freezer, logged_user):
1717
freezer.move_to(facade.launch_datetime_finish + timedelta(seconds=1))
1818
client.force_login(logged_user)
19-
return client.get(reverse('checkout:membership_lp'), secure=True)
19+
return client.get(reverse('checkout:membership_lp'))
2020

2121

2222
def test_tag_as_called(resp, logged_user, tag_as_mock):
@@ -34,7 +34,7 @@ def test_subscription_link_is_present(resp):
3434
@pytest.fixture
3535
def resp_no_user(client, freezer):
3636
freezer.move_to(facade.launch_datetime_finish + timedelta(seconds=1))
37-
resp = client.get(reverse('checkout:membership_lp'), secure=True)
37+
resp = client.get(reverse('checkout:membership_lp'))
3838
return resp
3939

4040

pythonpro/checkout/tests/test_membership_lp_when_subscription_open.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def tag_as_mock(mocker):
1515
@pytest.fixture
1616
def resp_no_user_after_discount(client, tag_as_mock, freezer):
1717
freezer.move_to(facade.discount_datetime_limit + timedelta(seconds=1))
18-
return client.get(reverse('checkout:membership_lp'), secure=True)
18+
return client.get(reverse('checkout:membership_lp'))
1919

2020

2121
def test_no_user_status_code(resp_no_user_after_discount):
@@ -42,7 +42,7 @@ def test_no_user_no_discount(resp_no_user_after_discount):
4242
@pytest.fixture
4343
def resp_no_user_before_discount(client, tag_as_mock, freezer):
4444
freezer.move_to(facade.discount_datetime_limit - timedelta(seconds=1))
45-
return client.get(reverse('checkout:membership_lp'), secure=True)
45+
return client.get(reverse('checkout:membership_lp'))
4646

4747

4848
def test_no_user_with_first_day_discount(resp_no_user_before_discount):
@@ -60,7 +60,7 @@ def test_no_user_with_first_day_discount(resp_no_user_before_discount):
6060
def resp_with_lead_after_discount(client_with_lead, logged_user, tag_as_mock, freezer):
6161
freezer.move_to(facade.discount_datetime_limit + timedelta(seconds=1))
6262
client_with_lead.force_login(logged_user) # freezer for some reason logout user, so must be logged again
63-
return client_with_lead.get(reverse('checkout:membership_lp'), secure=True)
63+
return client_with_lead.get(reverse('checkout:membership_lp'))
6464

6565

6666
def test_tag_as_called(resp_with_lead_after_discount, logged_user, tag_as_mock):
@@ -74,14 +74,14 @@ def test_lead_without_discount(resp_with_lead_after_discount):
7474
def test_lead_with_first_day_discount(client_with_lead, logged_user, tag_as_mock, freezer):
7575
freezer.move_to(facade.discount_datetime_limit - timedelta(seconds=1))
7676
client_with_lead.force_login(logged_user) # freezer for some reason logout user, so must be logged again
77-
resp = client_with_lead.get(reverse('checkout:membership_lp'), secure=True)
77+
resp = client_with_lead.get(reverse('checkout:membership_lp'))
7878
test_no_user_with_first_day_discount(resp)
7979

8080

8181
def test_client_without_first_day_discount(client_with_client, logged_user, tag_as_mock, freezer):
8282
freezer.move_to(facade.discount_datetime_limit + timedelta(seconds=1))
8383
client_with_client.force_login(logged_user) # freezer for some reason logout user, so must be logged again
84-
resp = client_with_client.get(reverse('checkout:membership_lp'), secure=True)
84+
resp = client_with_client.get(reverse('checkout:membership_lp'))
8585
assert resp.context['payment_item_config'].slug == 'membership-client'
8686
assert resp.context['client_discount'] == 10000
8787
assert resp.context['first_day_discount'] == 0
@@ -95,7 +95,7 @@ def test_client_without_first_day_discount(client_with_client, logged_user, tag_
9595
def test_client_with_first_day_discount(client_with_client, logged_user, tag_as_mock, freezer):
9696
freezer.move_to(facade.discount_datetime_limit - timedelta(seconds=1))
9797
client_with_client.force_login(logged_user) # freezer for some reason logout user, so must be logged again
98-
resp = client_with_client.get(reverse('checkout:membership_lp'), secure=True)
98+
resp = client_with_client.get(reverse('checkout:membership_lp'))
9999
assert resp.context['payment_item_config'].slug == 'membership-client-first-day'
100100
assert resp.context['client_discount'] == 10000
101101
assert resp.context['first_day_discount'] == 40000

pythonpro/checkout/tests/test_waiting_list_ty.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def resp(subscription_closed, client_with_lead, logged_user, create_or_update_wi
2525
'first_name': logged_user.first_name,
2626
'phone': logged_user.phone
2727
}
28-
yield client_with_lead.post(reverse('checkout:membership_lp'), data, secure=True)
28+
yield client_with_lead.post(reverse('checkout:membership_lp'), data)
2929

3030

3131
def test_logged_user_updated(resp, logged_user, create_or_update_with_no_role_mock):
@@ -51,7 +51,7 @@ def resp_anonymous_user_existing_email(subscription_closed, client, logged_user,
5151
'first_name': logged_user.first_name,
5252
'phone': logged_user.phone
5353
}
54-
yield client.post(reverse('checkout:membership_lp'), data, secure=True)
54+
yield client.post(reverse('checkout:membership_lp'), data)
5555

5656

5757
def test_anonymous_user_existing_email_updated(resp_anonymous_user_existing_email, logged_user,
@@ -73,7 +73,7 @@ def anonymous_form_data():
7373
@pytest.fixture
7474
def resp_anonymous_user_missing_email(subscription_closed, client, create_or_update_with_no_role_mock,
7575
anonymous_form_data, db):
76-
yield client.post(reverse('checkout:membership_lp'), anonymous_form_data, secure=True)
76+
yield client.post(reverse('checkout:membership_lp'), anonymous_form_data)
7777

7878

7979
def test_anonymous_user_missing_email_updated(resp_anonymous_user_missing_email, anonymous_form_data,

pythonpro/cohorts/tests/test_cohorts.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
@pytest.fixture
1818
def resp(client_with_member, cohort):
19-
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}), secure=True)
19+
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}))
2020

2121

2222
@pytest.fixture
2323
def resp_without_user(client, db):
2424
image = SimpleUploadedFile(name='renzo-nuccitelli.jpeg', content=open(img_path, 'rb').read(),
2525
content_type='image/png')
2626
cohort = mommy.make(Cohort, slug='guido-van-rossum', image=image)
27-
resp = client.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}), secure=True)
27+
resp = client.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}))
2828
return resp
2929

3030

@@ -39,7 +39,7 @@ def test_cohort_links_for_logged_user(client, django_user_model):
3939
image = SimpleUploadedFile(name='renzo-nuccitelli.jpeg', content=open(img_path, 'rb').read(),
4040
content_type='image/png')
4141
cohorts = mommy.make(Cohort, 4, image=image)
42-
resp = client.get(reverse('dashboard:home'), secure=True)
42+
resp = client.get(reverse('dashboard:home'))
4343
for c in cohorts:
4444
dj_assert_contains(resp, c.get_absolute_url())
4545

@@ -49,7 +49,7 @@ def test_cohort_links_not_avaliable_for_no_user(client):
4949
image = SimpleUploadedFile(name='renzo-nuccitelli.jpeg', content=open(img_path, 'rb').read(),
5050
content_type='image/png')
5151
cohorts = mommy.make(Cohort, 4, image=image)
52-
resp = client.get('/', secure=True)
52+
resp = client.get('/')
5353
for c in cohorts:
5454
dj_assert_not_contains(resp, c.get_absolute_url())
5555

@@ -111,7 +111,7 @@ def future_live_classes(cohort, fake):
111111

112112
@pytest.fixture
113113
def resp_with_classes(recorded_live_classes, future_live_classes, cohort, client_with_member):
114-
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}), secure=True)
114+
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}))
115115

116116

117117
def test_live_classes_are_sorted(recorded_live_classes, cohort):
@@ -175,7 +175,7 @@ def test_future_webinars_in_cohort(recorded_webinars, future_webinars, cohort):
175175

176176
@pytest.fixture
177177
def resp_with_webnars(recorded_webinars, future_webinars, cohort, client_with_member):
178-
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}), secure=True)
178+
return client_with_member.get(reverse('cohorts:detail', kwargs={'slug': cohort.slug}))
179179

180180

181181
def test_webnars_are_sorted(recorded_webinars: list, cohort):

0 commit comments

Comments
 (0)