Added HostingUserLoginForm test, Added HostingUserSignupForm test, Added PasswordResetRequestForm Test, Added SetPasswordForm test, Created custom 404 page
This commit is contained in:
parent
0dc81fff3d
commit
b34d84657e
9 changed files with 224 additions and 7 deletions
|
|
@ -48,7 +48,6 @@ class SetPasswordForm(forms.Form):
|
|||
return password2
|
||||
|
||||
|
||||
|
||||
class BillingAddressForm(forms.ModelForm):
|
||||
token = forms.CharField(widget=forms.HiddenInput())
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ class StripeUtils(object):
|
|||
)
|
||||
return customer
|
||||
|
||||
|
||||
@handleStripeError
|
||||
def make_charge(self, amount=None, customer=None):
|
||||
amount = int(amount * 100) # stripe amount unit, in cents
|
||||
|
|
|
|||
|
|
@ -1,5 +1,51 @@
|
|||
from django.test import TestCase
|
||||
from .forms import ContactUsForm, BillingAddressForm
|
||||
from .forms import ContactUsForm, BillingAddressForm, PasswordResetRequestForm,\
|
||||
SetPasswordForm
|
||||
|
||||
from model_mommy import mommy
|
||||
|
||||
|
||||
class PasswordResetRequestFormTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.user = mommy.make('CustomUser')
|
||||
self.completed_data = {
|
||||
'email': self.user.email,
|
||||
}
|
||||
|
||||
self.incorrect_data = {
|
||||
'email': 'test',
|
||||
}
|
||||
|
||||
def test_valid_form(self):
|
||||
form = PasswordResetRequestForm(data=self.completed_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_invalid_form(self):
|
||||
form = PasswordResetRequestForm(data=self.incorrect_data)
|
||||
self.assertFalse(form.is_valid())
|
||||
|
||||
|
||||
class SetPasswordFormTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
# self.user = mommy.make('CustomUser')
|
||||
self.completed_data = {
|
||||
'new_password1': 'new_password',
|
||||
'new_password2': 'new_password',
|
||||
}
|
||||
|
||||
self.incorrect_data = {
|
||||
'email': 'test',
|
||||
}
|
||||
|
||||
def test_valid_form(self):
|
||||
form = SetPasswordForm(data=self.completed_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
|
||||
def test_invalid_form(self):
|
||||
form = SetPasswordForm(data=self.incorrect_data)
|
||||
self.assertFalse(form.is_valid())
|
||||
|
||||
|
||||
class ContactUsFormTest(TestCase):
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ from django.http.request import HttpRequest
|
|||
from model_mommy import mommy
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class BaseTestCase(TestCase):
|
||||
"""
|
||||
Base class to initialize the test cases
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue