Added paremeter user to MockHttpRequest. Added tests for http module. #12

Merged
merged 2 commits into from Mar 29, 2013

Conversation

Projects
None yet
2 participants
Contributor

alej0varas commented Jan 30, 2013

Patch for issue #11

mock_django/http.py
@@ -54,6 +54,8 @@ def MockHttpRequest(path='/', method='GET', GET=None, POST=None, META=None):
'HTTP_REFERER': '',
'SERVER_NAME': 'testserver',
}
+ if user is not None:
+ user = user()
@dcramer

dcramer Jan 30, 2013

Owner

Wouldn't you want to be able to pass a user instance?

@alej0varas

alej0varas Jan 30, 2013

Contributor

Yes, it's better a instance. I'm going to change it.

@@ -54,6 +54,8 @@ def MockHttpRequest(path='/', method='GET', GET=None, POST=None, META=None):
'HTTP_REFERER': '',
'SERVER_NAME': 'testserver',
}
+ if user is not None:
@dcramer

dcramer Jan 30, 2013

Owner

Probably makes more sense to set it to AnonymousUser() here :)

@alej0varas

alej0varas Jan 30, 2013

Contributor

Removing it from WsgiHttpRequest? I don't wanted to change the WsgiHttpRequest code. If it's safe I can doit.

dcramer added a commit that referenced this pull request Mar 29, 2013

Merge pull request #12 from alej0varas/patch-1
Added paremeter user to MockHttpRequest. Added tests for http module.

@dcramer dcramer merged commit 1036ab1 into dcramer:master Mar 29, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment