Permalink
Browse files

Changed user parameter to be a user instance

  • Loading branch information...
1 parent 86408b3 commit 9e68b5bec0eb488c01846c8b3031c6bb3dfd6cd7 @alej0varas alej0varas committed Jan 30, 2013
Showing with 6 additions and 5 deletions.
  1. +2 −2 mock_django/http.py
  2. +4 −3 tests/mock_django/http/tests.py
View
@@ -40,7 +40,7 @@ def _set_raw_post_data(self, data):
raw_post_data = property(_get_raw_post_data, _set_raw_post_data)
-def MockHttpRequest(path='/', method='GET', GET=None, POST=None, META=None, user=AnonymousUser):
+def MockHttpRequest(path='/', method='GET', GET=None, POST=None, META=None, user=None):
if GET is None:
GET = {}
if POST is None:
@@ -55,7 +55,7 @@ def MockHttpRequest(path='/', method='GET', GET=None, POST=None, META=None, user
'SERVER_NAME': 'testserver',
}
if user is not None:
- user = user()
+ user = user
request = WsgiHttpRequest()
request.path = request.path_info = path
@@ -71,8 +71,9 @@ def test_call(self):
self.assertTrue(isinstance(result.user, AnonymousUser))
def test_call(self):
- mock_user = Mock()
+ class MockUser:
+ pass
- result = MockHttpRequest(user=mock_user)
+ result = MockHttpRequest(user=MockUser())
- self.assertTrue(isinstance(result.user, Mock))
+ self.assertTrue(isinstance(result.user, MockUser))

0 comments on commit 9e68b5b

Please sign in to comment.