Commits

takanao ENDOH committed fa43524

Fixed AttributeError in API::create.

Comments (0)

Files changed (2)

monologista/api/tests.py

         self.assertContains(self.client.post('/api/activate.json', dict(id=2)), '"activate": true', 1, 200)
         self.assertEqual(Monology.objects.filter(activate=True).count(), 2)
 
+    def test_create(self):
+        self.assertTrue(self.client.login(username='spam', password='spam'))
+        self.assertContains(self.client.post('/api/create/spam.json'), "", None, 200)
+
     def test_deactivate(self):
         self.assertEqual(Monology.objects.filter(activate=False).count(), 1)
         self.assertContains(self.client.get('/api/deactivate.json'), "", None, 405)

monologista/api/views.py

         # XXX メッセージ ... すでに登録しているよ
         return HttpResponseBadRequest("Already watching %s." % username)
 
-    user.get_profile().contacts.add(account)
+    owner.get_profile().contacts.add(account)
 
     if format == 'json':
         data = 'json'