def test_label_object(self): mo = MuseumObject() mo.object_number = 'O73708' mo.save() #bind the object to the Digital Label rel = DigitalLabelObject(museumobject=mo, digitallabel=DigitalLabel.objects.get(id=1)) rel.save() response = self.client.get('/digitallabel/1/') self.assertContains(response, '<div class="title"><h2>Washstand</h2></div>', 1, 200)
def test_gateway_object(self): mo = MuseumObject() mo.object_number = 'O59319' mo.save() #bind the object to the Digital Label rel = DigitalLabelObject(museumobject=mo, digitallabel=DigitalLabel.objects.get(id=1), gateway_object=True) rel.save() response = self.client.get('/digitallabel/1/') self.assertContains(response, """<li class="home txt obj"> <div class="mask"></div> <div class="title"><h2>Armchair</h2></div>""", 1, 200)
def test_timeout_images(self): mo = MuseumObject() mo.object_number = 'O321535' mo.save() #bind the object to the Digital Label rel = DigitalLabelObject(museumobject=mo, digitallabel=DigitalLabel.objects.get(id=1), gateway_object=True) rel.save() response = self.client.get('/digitallabel/1/') self.assertNotContains(response, '<img class="timeout"', 200) dl = DigitalLabel.objects.get(id=1) dl.timeout_images.add(Image.objects.get(id=1)) dl.save() from django.conf import settings response = self.client.get('/digitallabel/1/') if settings.KIOSK_MODE: self.assertContains(response, '<img class="timeout"', 1, 200) else: self.assertNotContains(response, '<img class="timeout"', 200)
def test_new_object(self): mo = MuseumObject() mo.name = 'Name' mo.date_text = 'Date text' mo.artist_maker = 'Artist maker' mo.place = 'Place' mo.materials_techniques = 'Materials techniques' mo.museum_number = 'Museum number' mo.object_number = '012345' mo.credit_line = 'Credit line' mo.main_text = """Main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text.""" mo.save()
def test_museumobject(self): #create a Museum Object mo = MuseumObject() mo.name = 'Armchair' mo.date_text = '1904 (made)' mo.artist_maker = 'Wright, Frank Lloyd' mo.place = 'America' mo.materials_techniques = """Frame: painted steel, with cast-iron base and rubber castersUpholstery: slip seat with horsehair(?) stuffing, and leather cover (probably original)""" mo.museum_number = 'W.43-1981' mo.object_number = 'O112088' mo.credit_line = 'Lorem ipsum' mo.main_text = """Wright designed a variety of metal chairs and desks for the headquarters of this mail-order soap company. The client's requirement that the building be fireproof provided the impetus for Wright's use of metal. The form of the chair and the decoration of perforated squares on the back indicate Wright's likely awareness of contemporary Viennese design.""" mo.save() #bind the object to a portal rel = PortalObject(museumobject=mo, portal=Portal.objects.get(id=1)) rel.save() #test the object appear in the Portal response = self.client.get('/portal/1/') self.assertContains(response, '<div class="title"><h2>Armchair</h2></div>', 1, 200)
def test_new_loanobject(self): """ Loan objects do not have O numbers but don't punish them """ mo = MuseumObject() mo.name = 'Name' mo.date_text = 'Date text' mo.artist_maker = 'Artist maker' mo.place = 'Place' mo.materials_techniques = 'Materials techniques' mo.museum_number = 'Museum number' mo.credit_line = 'Credit line' mo.main_text = """Main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text, main text.""" mo.save()