Beispiel #1
0
 def test_is_published(self):
     data = serializers.FeedShelfSerializer(self.shelf,
                                            context=self.context).data
     assert not data['is_published']
     self.shelf.feeditem_set.create()
     data = serializers.FeedShelfSerializer(self.shelf,
                                            context=self.context).data
     assert data['is_published']
Beispiel #2
0
 def test_shelf_get_apps_deleted_app(self):
     """
     Regression test for bug 1124319; ensures that deleted apps also delete
     any respective FeedShelfMembership objects.
     """
     app_id = self.app_ids.pop()
     ok_(FeedShelfMembership.objects.filter(app__id=app_id).count() >= 1)
     Webapp.objects.get(pk=app_id).delete()
     eq_(FeedShelfMembership.objects.filter(app__id=app_id).count(), 0)
     try:
         serializers.FeedShelfSerializer(self.shelf,
                                         context=self.context).data
     except Webapp.DoesNotExist:
         self.fail('Deleted app does not delete shelf membership object.')
Beispiel #3
0
 def test_deserialize(self):
     data = serializers.FeedShelfSerializer(self.shelf,
                                            context=self.context).data
     eq_(data['slug'], self.shelf.slug)
     self.assertSetEqual([app['id'] for app in data['apps']], self.app_ids)