Permalink
Browse files

[bug 933786] Fix test_null_device_returns_400

This fixes the test so that it's testing the right thing and passes
correctly.
  • Loading branch information...
1 parent 2324aa3 commit ef15fef66af074dceba5270492b7085ac03eced5 @willkg willkg committed Feb 11, 2014
Showing with 7 additions and 11 deletions.
  1. +7 −11 fjord/feedback/tests/test_api.py
View
18 fjord/feedback/tests/test_api.py
@@ -1,3 +1,5 @@
+import json
+
from django.conf import settings
from nose.tools import eq_
@@ -110,17 +112,11 @@ def test_null_device_returns_400(self):
'device': None
}
- r = self.client.post(reverse('api-post-feedback'), data)
- eq_(r.status_code, 201)
-
- feedback = models.Response.objects.latest(field_name='id')
- eq_(feedback.happy, True)
- eq_(feedback.description, data['description'])
- eq_(feedback.product, data['product'])
-
- # Fills in defaults
- eq_(feedback.url, u'')
- eq_(feedback.user_agent, u'api')
+ r = self.client.post(reverse('api-post-feedback'),
+ json.dumps(data),
+ content_type='application/json')
+ eq_(r.status_code, 400)
+ assert 'device' in r.content
def test_invalid_email_address_returns_400(self):
data = {

0 comments on commit ef15fef

Please sign in to comment.