Private
Public Access
1
0

committing survey

This commit is contained in:
Sander Roosendaal
2020-01-08 22:43:41 +01:00
parent cfc61e8621
commit 09a490c064
25 changed files with 572 additions and 597 deletions

View File

@@ -15,7 +15,7 @@ class PaymentTest(TestCase):
def setUp(self):
# settings.DEBUG = True
p1 = PaidPlan(
shortname='free',
name='Basic',
@@ -64,7 +64,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -79,7 +79,7 @@ class PaymentTest(TestCase):
u.save()
login = self.c.login(username=u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/billing/'
response = self.c.get(url)
@@ -93,7 +93,7 @@ class PaymentTest(TestCase):
for code, name in list(countries):
if name.lower() == country.lower():
countrycode = code
form_data = {
'street_address':faker.street_address(),
'city':faker.city(),
@@ -112,7 +112,7 @@ class PaymentTest(TestCase):
self.assertEqual(response.status_code,200)
expected_url = '/rowers/checkout/'+str(plan.id)+'/'
self.assertRedirects(response,
expected_url = expected_url,
status_code=302,target_status_code=200)
@@ -122,7 +122,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -139,10 +139,10 @@ class PaymentTest(TestCase):
r.save()
u.set_password(self.password)
u.save()
login = self.c.login(username=u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/upgrade/'
response = self.c.get(url)
@@ -156,7 +156,7 @@ class PaymentTest(TestCase):
for code, name in list(countries):
if name.lower() == country.lower():
countrycode = code
form_data = {
'street_address':faker.street_address(),
'city':faker.city(),
@@ -175,7 +175,7 @@ class PaymentTest(TestCase):
self.assertEqual(response.status_code,200)
expected_url = '/rowers/upgradecheckout/'+str(plan.id)+'/'
self.assertRedirects(response,
expected_url = expected_url,
status_code=302,target_status_code=200)
@@ -185,7 +185,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -208,10 +208,10 @@ class PaymentTest(TestCase):
r.save()
u.set_password(self.password)
u.save()
login = self.c.login(username=u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/downgrade/'
response = self.c.get(url)
@@ -222,7 +222,7 @@ class PaymentTest(TestCase):
for code, name in list(countries):
if name.lower() == country.lower():
countrycode = code
form_data = {
'street_address':faker.street_address(),
'city':faker.city(),
@@ -241,7 +241,7 @@ class PaymentTest(TestCase):
self.assertEqual(response.status_code,200)
expected_url = '/rowers/downgradecheckout/'+str(plans[0].id)+'/'
self.assertRedirects(response,
expected_url = expected_url,
status_code=302,target_status_code=200)
@@ -251,7 +251,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -274,22 +274,22 @@ class PaymentTest(TestCase):
r.paidplan = plan
r.save()
login = self.c.login(username=u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/me/cancelsubscriptions/'
response = self.c.get(url)
self.assertEqual(response.status_code,200)
@patch('rowers.views.braintreestuff.gateway',side_effect=MockBraintreeGateway)
def test_planstobasic_view(self,mocked_gateway):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -312,10 +312,10 @@ class PaymentTest(TestCase):
r.paidplan = plan
r.save()
login = self.c.login(username=u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/me/cancelsubscription/34/'
response = self.c.get(url,follow=True)
@@ -329,7 +329,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -344,13 +344,13 @@ class PaymentTest(TestCase):
r.save()
result = mocktest(r)
self.assertEqual(result,'121')
@patch('rowers.views.braintreestuff.create_subscription', side_effect=mock_create_subscription)
def test_checkouts_view(self,mock_subscription):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -396,7 +396,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -435,13 +435,13 @@ class PaymentTest(TestCase):
self.assertRedirects(response,
expected_url = '/rowers/paymentcompleted/?amount=20.00',
status_code=302,target_status_code=200)
@patch('rowers.views.braintreestuff.update_subscription', side_effect=mock_update_subscription)
def test_downgrade_checkouts_view(self,mock_subscription):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -480,13 +480,13 @@ class PaymentTest(TestCase):
self.assertRedirects(response,
expected_url = '/rowers/downgradecompleted/',
status_code=302,target_status_code=200)
@patch('rowers.views.braintreestuff.create_subscription', side_effect=mock_create_subscription)
def test_checkouts_view(self,mock_subscription):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -536,7 +536,7 @@ class PaymentTest(TestCase):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -575,13 +575,13 @@ class PaymentTest(TestCase):
self.assertRedirects(response,
expected_url = '/rowers/paymentcompleted/?amount=20.00',
status_code=302,target_status_code=200)
@patch('rowers.views.braintreestuff.update_subscription', side_effect=mock_update_subscription)
def test_downgrade_checkouts_view(self,mock_subscription):
u = UserFactory()
r = Rower.objects.create(user=u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
rowerplan='coach',
paymentprocessor='braintree',
@@ -620,4 +620,3 @@ class PaymentTest(TestCase):
self.assertRedirects(response,
expected_url = '/rowers/downgradecompleted/',
status_code=302,target_status_code=200)