Exemple #1
0
 def test_automatic_creator(self):
     del self.data['creator']
     serializer = api.PushNotificationRegistrationSerializer(
         context=self.context, data=self.data)
     ok_(serializer.is_valid())
     eq_(serializer.errors, {})
     eq_(serializer.object.creator, self.user)
Exemple #2
0
 def test_cant_register_for_other_users(self):
     wrong_user = user(save=True)
     self.data['creator'] = wrong_user
     serializer = api.PushNotificationRegistrationSerializer(
         context=self.context, data=self.data)
     ok_(not serializer.is_valid())
     eq_(serializer.errors, {
         'creator': ["Can't register push notifications for another user."],
     })
Exemple #3
0
 def test_cant_register_for_other_users(self):
     wrong_user = UserFactory()
     self.data["creator"] = wrong_user
     serializer = api.PushNotificationRegistrationSerializer(
         context=self.context, data=self.data)
     ok_(not serializer.is_valid())
     eq_(
         serializer.errors,
         {
             "creator":
             ["Can't register push notifications for another user."],
         },
     )