Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add test for user view.

  • Loading branch information...
commit 209774dfff05f0716cccca61bd8baa7eb456badf 1 parent f4986b4
@Osmose Osmose authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 apps/news/tests.py
View
21 apps/news/tests.py
@@ -0,0 +1,21 @@
+from django import test
+from django.http import QueryDict
+
+from mock import patch
+
+from news.models import Subscriber
+from news.tasks import SET
+
+
+class UserTest(test.TestCase):
+ @patch('news.views.update_user')
+ def test_user_set(self, update_user):
+ """If the user view is sent a POST request, it should attempt to update
+ the user's info.
+ """
+ subscriber = Subscriber(email='test@example.com', token='asdf')
+ subscriber.save()
+
+ self.client.post('/news/user/asdf/', {'fake': 'data'})
+ update_user.assert_called_with(QueryDict('fake=data'),
+ 'test@example.com', SET, True)
Please sign in to comment.
Something went wrong with that request. Please try again.