Ejemplo n.º 1
0
    def test_deleteChannel(self):
        program = self._createProgram(EpgProgram, 1)
        program.genres = [self._createProgramGenre(EpgProgramGenre, 1)]
        program.actors = [self._createProgramPerson(EpgProgramActor, 1)]
        program.directors = [self._createProgramPerson(EpgProgramDirector, 1)]
        program.presenters = [
            self._createProgramPerson(EpgProgramPresenter, 1)
        ]
        program.addToDb(self.db)

        program = EpgProgram.getFromDb(self.db, program.id)
        program.deleteFromDb(self.db)

        getProgram = EpgProgram.getFromDb(self.db, program.id)
        self.assertIsNone(getProgram, "Program still in database")

        genres = EpgProgramGenre.getAllFromDb(self.db, program.id)
        self.assertEqual(genres, [], "Program genres still in database")

        actors = EpgProgramActor.getAllFromDb(self.db, program.id)
        self.assertEqual(actors, [], "Program actors still in database")

        directors = EpgProgramDirector.getAllFromDb(self.db, program.id)
        self.assertEqual(directors, [], "Program directors still in database")

        presenters = EpgProgramPresenter.getAllFromDb(self.db, program.id)
        self.assertEqual(presenters, [],
                         "Program presenters still in database")
Ejemplo n.º 2
0
    def test_deletePerson(self):
        actors = [
            self._createProgramPerson(EpgProgramActor, x) for x in range(2)
        ]
        program = self._createProgram(EpgProgram, 1)
        program.actors = [actor for actor in actors]
        program.addToDb(self.db)

        program = EpgProgram.getFromDb(self.db, program.id)
        program.actors.remove(actors[0])
        program.addToDb(self.db)

        program = EpgProgram.getFromDb(self.db, program.id)
        self.assertNotIn(actors[0], program.actors,
                         "Program person still in program")
Ejemplo n.º 3
0
    def test_deleteGenre(self):
        genres = [
            self._createProgramGenre(EpgProgramGenre, x) for x in range(2)
        ]
        program = self._createProgram(EpgProgram, 1)
        program.genres = [genre for genre in genres]
        program.addToDb(self.db)

        program = EpgProgram.getFromDb(self.db, program.id)
        program.genres.remove(genres[0])
        program.addToDb(self.db)

        program = EpgProgram.getFromDb(self.db, program.id)
        self.assertNotIn(genres[0], program.genres,
                         "Program genre still in program")
Ejemplo n.º 4
0
    def test_addGenre(self):
        program = self._createProgram(EpgProgram, 1)
        program.addToDb(self.db)

        program.genres.append(self._createProgramGenre(EpgProgramGenre, 1))
        program.addToDb(self.db)

        getProgram = EpgProgram.getFromDb(self.db, program.id)
        self.assertSetEqual(
            set(getProgram.genres), set(program.genres),
            "Added program genre not equal to program genre in database")
Ejemplo n.º 5
0
    def test_addPerson(self):
        program = self._createProgram(EpgProgram, 1)
        program.addToDb(self.db)

        programPerson = self._createProgramPerson(EpgProgramActor, 1)
        program.actors.append(programPerson)
        program.addToDb(self.db)

        getProgram = EpgProgram.getFromDb(self.db, program.id)
        self.assertSetEqual(
            set(getProgram.actors), set(program.actors),
            "Added program person not equal to program person in database")
Ejemplo n.º 6
0
    def test_getChannel(self):
        program = self._createProgram(EpgProgram, 1)
        program.genres = [self._createProgramGenre(EpgProgramGenre, 1)]
        program.actors = [self._createProgramPerson(EpgProgramActor, 1)]
        program.directors = [self._createProgramPerson(EpgProgramDirector, 1)]
        program.presenters = [
            self._createProgramPerson(EpgProgramPresenter, 1)
        ]
        program.addToDb(self.db)

        getProgram = EpgProgram.getFromDb(self.db, program.id)
        self.assertIsNotNone(getProgram, "Program does not exist in database")
        self.assertEqual(program, getProgram,
                         "Added program not equal to program in database")