def test_gbobjects_published(self): self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_2.status = PUBLISHED self.gbobject_2.save() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 2) self.gbobject_1.sites.clear() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.sites.add(*self.sites) self.gbobject_1.start_publication = datetime(2020, 1, 1) self.gbobject_1.save() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.start_publication = datetime(2000, 1, 1) self.gbobject_1.save() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 2) self.gbobject_1.end_publication = datetime(2000, 1, 1) self.gbobject_1.save() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.end_publication = datetime(2020, 1, 1) self.gbobject_1.save() self.assertEquals( gbobjects_published(Gbobject.objects.all()).count(), 2)
def test_gbobjects_published(self): self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_2.status = PUBLISHED self.gbobject_2.save() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2) self.gbobject_1.sites.clear() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.sites.add(*self.sites) self.gbobject_1.start_publication = datetime(2020, 1, 1) self.gbobject_1.save() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.start_publication = datetime(2000, 1, 1) self.gbobject_1.save() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2) self.gbobject_1.end_publication = datetime(2000, 1, 1) self.gbobject_1.save() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 1) self.gbobject_1.end_publication = datetime(2020, 1, 1) self.gbobject_1.save() self.assertEquals(gbobjects_published(Gbobject.objects.all()).count(), 2)
def gbobjects_published(self): """Return only the gbobjects published""" return gbobjects_published(self.gbobjects)
def related_published(self): """Return only related gbobjects published""" return gbobjects_published(self.related)
def items(self, obj): """Items are the published gbobjects of the author""" return gbobjects_published(obj.gbobjects)[:FEEDS_MAX_ITEMS]