Esempio n. 1
0
    def test_edit_TextLabel(self):
        #create a new Text Label
        tl = TextLabel()
        tl.title = 'Historical Context 2'
        tl.biography = False
        tl.main_text = """The massive stained oak table combines forms derived from the
                            Gothic Revival and Arts and Crafts movements of the later
                            19th century. The colour and shape of the table, and of other
                            pieces of furniture, were echoed in interior details throughout
                            the house. Wright believed that wood should be cut simply and
                            stained (never varnished) to reveal the 'nature' of the material."""
        tl.save()

        #bind the object to a portal
        rel = PortalTextLabel(textlabel=tl, portal=Portal.objects.get(id=1))
        rel.save()

        #get the Text Label and set the new title 
        tl = TextLabel.objects.get(id=1)
        replacing_title = 'The stained oak table'
        self.assertNotEqual(tl.title, replacing_title)

        # change the title
        tl.title = replacing_title
        tl.save()
        self.assertEqual(tl.title, replacing_title)

        #test the title has changed in the portal view
        response = self.client.get('/portal/1/')
        self.assertContains(response, """<div class="title"><h2>The stained oak table</h2></div>""", 1, 200)
Esempio n. 2
0
    def test_textlabel(self):
        #create a Text Label
        tl = TextLabel()
        tl.title = 'Frank Lloyd Wright (Biography)'
        tl.main_text = """Frank Lloyd Wright (born Frank Lincoln Wright,
                            June 8, 1867 - April 9, 1959) was an American architect,
                            interior designer, writer and educator, who designed
                            more than 1,000 structures and completed 500 works.
                            Wright believed in designing structures which were
                            in harmony with humanity and its environment, a
                            philosophy he called organic architecture. This
                            philosophy was best exemplified by his design for
                            Fallingwater (1935), which has been called "the best
                            all-time work of American architecture".[1] Wright was
                            a leader of the Prairie School movement of architecture
                            and developed the concept of the Usonian home, his unique
                            vision for urban planning in the United States."""
        tl.save()

        #bind the object to a portal
        rel = PortalTextLabel(textlabel=tl, portal=Portal.objects.get(id=1), biography=True)
        rel.save()

        #test the text label appear in the HTML of the portal page
        response = self.client.get('/portal/1/')
        self.assertContains(response, """<div class="title"><h2>Frank Lloyd Wright (Biography)</h2></div>""", 1, 200)