Exemplo n.º 1
0
    def makePlay(valClass):
        """Initiates and returns a play data access object with the values contained in valClass"""

        dao = Play()
        
        dao.url_title = valClass.url_title
        dao.title = valClass.title
        dao.director = valClass.director
        dao.actors = valClass.actors
        dao.description = valClass.description
        dao.image = valClass.image
        dao.show_times = valClass.show_times

        return dao
Exemplo n.º 2
0
    def testCanRefreshPlaysFromDatabase(self):
        """Test if the play can be updated and the updated version is refreshed from the database"""

        play = Play()

        play.director = "Director"
        play.url_title = "URL Title"
        play.title = "Title"

        play.save()

        # This updates the title of all plays in the database. This may be a bad idea, but for now it works.
        Play.objects.update(title="New Title")

        play.refresh_from_db()
        self.assertEqual("New Title", play.title)