Exemplo n.º 1
0
 def test_for_object(self):
     out = templates.ld_for_object(self.person)
     self.assertEqual(
         out,
         self.script({
             '@context':
             'http://schema.org',
             '@id':
             'http://localhost/alex-citizen/',
             '@type':
             'Person',
             'birthDate':
             '1970-01-01',
             'description':
             '',
             'image':
             image_ld(self.image,
                      base_url='http://localhost'),  # tested separately
             'name':
             'Alex Citizen',
             'organisation': {
                 '@id': 'http://localhost',
                 '@type': '@id',
             },
             'url':
             'http://localhost/alex-citizen/',
         }))
Exemplo n.º 2
0
 def ld_entity(self):
     site = self.get_site()
     return extend(
         super().ld_entity(), {
             '@type':
             'Event',
             "name":
             self.title,
             "startDate":
             (datetime.combine(self.date_from,
                               self.time_from)).strftime('%d-%m-%YT%H:%M'),
             "endDate": (datetime.combine(self.date_from, self.time_from) +
                         timedelta(hours=6)).strftime('%d-%m-%YT%H:%M'),
             "url":
             site.root_url + self.url,
             "eventStatus":
             "EventScheduled",
             "image":
             image_ld(self.image, base_url=site.root_url),
             "location": {
                 "@type": "Place",
                 "name": self.location_name,
                 "address": self.location
             },
             "offers": {
                 "@type": "Offer",
                 "url": "https://www.willysbrewing.com/cervezas/riot-apa",
                 "category": "primary",
                 "availability": "InStock",
                 "price": "3.50",
                 "priceCurrency": "EUR"
             }
         })
Exemplo n.º 3
0
 def ld_entity(self):
     site = self.get_site()
     return extend(
         super(PersonPage, self).ld_entity(), {
             '@type': 'Person',
             'birthDate': self.date_of_birth.isoformat(),
             'image': image_ld(self.photo, base_url=site.root_url),
             'organisation': TestOrganisation.for_site(site),
         })
Exemplo n.º 4
0
 def ld_entity(self):
     site = self.get_site()
     return extend(
         super().ld_entity(), {
             '@type': 'Product',
             "name": self.name,
             "image": image_ld(self.image, base_url=site.root_url),
             "brand": {
                 "@type": "Thing",
                 "name": "Willy's"
             }
         })