def testInsertMovieRightInput(self): db = MovieDatabase() db.Connect() self.assertTrue(db.InsertMovie(1245, "Description", "My Special Title", "Original Titke"), msg="testInsertMovieRightInput") db.DisConnect()
def testInsertMovieWrongTitle(self): db = MovieDatabase() db.Connect() self.assertFalse(db.InsertMovie(1245, "Description", None, "Original Ttitle"), msg="testInsertMovieWrongTitle") db.DisConnect()
def testInsertMovieNoneMovieId(self): db = MovieDatabase() db.Connect() self.assertFalse(db.InsertMovie(None, "Description", "Title", "Original Ttitle"), msg="testInsertMovieNoneMovieId") db.DisConnect()
from moviedataAPI import MoviesNowPlaying, MovieDirectors from moviedataDB import MovieDatabase db = MovieDatabase() if db.Connect(): movies = MoviesNowPlaying("GR") if movies: # if API returned movies list for movie in movies: if db.InsertMovie(movie['id'], movie['overview'], movie['title'], movie['original_title']): directors = MovieDirectors(movie['id']) if directors: # if API returned directors list for director in directors: if db.InsertDirector(director['person_id'], director['full_name'], director['imdb_id']): db.InsertMovieDirector(director['person_id'], movie['id']) db.CleanTables() else: print "ERROR! It was impossible to obtain movies" db.DisConnect()
def testInsertDirectorRightInput(self): db = MovieDatabase() db.Connect() self.assertTrue(db.InsertDirector(1564, "Nikos Tsentis", "nm12344"), msg="testInsertDirectorRightInput") db.DisConnect()
def testInsertDirectorWrongImdbId(self): db = MovieDatabase() db.Connect() self.assertFalse(db.InsertDirector("1245", "Name", None), msg="testInsertDirectorWrongDescription") db.DisConnect()
def testInsertDirectorNoneDirectorId(self): db = MovieDatabase() db.Connect() self.assertFalse(db.InsertDirector(None, "Name", "IMDB"), msg="testInsertDirectorNoneDirectorId") db.DisConnect()
def testInsertDirectorAllNull(self): db = MovieDatabase() db.Connect() self.assertFalse(db.InsertDirector(None, None, None), msg="testInsertDirectorAllNull") db.DisConnect()
def testInsertDirectorWithoutName(self): db = MovieDatabase() db.Connect() self.assertTrue(db.InsertDirector(15632, None, "nm12344321"), msg="testInsertDirectorRightInput") db.DisConnect()