Fixed duplicated post bug , Added reset password view test, Added confirm reset password view test

This commit is contained in:
Levi 2016-07-04 23:44:15 -05:00
commit 0dc81fff3d
4 changed files with 225 additions and 16 deletions

View file

@ -1,8 +1,13 @@
from django.test import TestCase
from django.test import Client
from django.http.request import HttpRequest
from model_mommy import mommy
class BaseTestCase(TestCase):
"""
Base class to initialize the test cases
@ -28,6 +33,11 @@ class BaseTestCase(TestCase):
self.customer_client = self.get_client(self.customer)
self.another_customer_client = self.get_client(self.another_customer)
# Request Object
self.request = HttpRequest()
self.request.META['SERVER_NAME'] = 'ungleich.com'
self.request.META['SERVER_PORT'] = '80'
def get_client(self, user):
"""
Authenticate a user and return the client
@ -64,3 +74,14 @@ class BaseTestCase(TestCase):
}]
}
}
def setup_view(self, view, *args, **kwargs):
"""Mimic as_view() returned callable, but returns view instance.
args and kwargs are the same you would pass to ``reverse()``
"""
view.request = self.request
view.args = args
view.kwargs = kwargs
return view