コード例 #1
0
ファイル: test_plays.py プロジェクト: GFUCABAM/statler
    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
コード例 #2
0
ファイル: test_plays.py プロジェクト: GFUCABAM/statler
    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)