Example #1
0
 def testInsertMovieRightInput(self):
     db = MovieDatabase()
     db.Connect()
     self.assertTrue(db.InsertMovie(1245, "Description", "My Special Title",
                                    "Original Titke"),
                     msg="testInsertMovieRightInput")
     db.DisConnect()
Example #2
0
 def testInsertMovieWrongTitle(self):
     db = MovieDatabase()
     db.Connect()
     self.assertFalse(db.InsertMovie(1245, "Description", None,
                                     "Original Ttitle"),
                      msg="testInsertMovieWrongTitle")
     db.DisConnect()
Example #3
0
 def testInsertMovieNoneMovieId(self):
     db = MovieDatabase()
     db.Connect()
     self.assertFalse(db.InsertMovie(None, "Description", "Title",
                                     "Original Ttitle"),
                      msg="testInsertMovieNoneMovieId")
     db.DisConnect()
Example #4
0
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()
Example #5
0
 def testInsertDirectorRightInput(self):
     db = MovieDatabase()
     db.Connect()
     self.assertTrue(db.InsertDirector(1564, "Nikos Tsentis", "nm12344"),
                     msg="testInsertDirectorRightInput")
     db.DisConnect()
Example #6
0
 def testInsertDirectorWrongImdbId(self):
     db = MovieDatabase()
     db.Connect()
     self.assertFalse(db.InsertDirector("1245", "Name", None),
                      msg="testInsertDirectorWrongDescription")
     db.DisConnect()
Example #7
0
 def testInsertDirectorNoneDirectorId(self):
     db = MovieDatabase()
     db.Connect()
     self.assertFalse(db.InsertDirector(None, "Name", "IMDB"),
                      msg="testInsertDirectorNoneDirectorId")
     db.DisConnect()
Example #8
0
 def testInsertDirectorAllNull(self):
     db = MovieDatabase()
     db.Connect()
     self.assertFalse(db.InsertDirector(None, None, None),
                      msg="testInsertDirectorAllNull")
     db.DisConnect()
Example #9
0
 def testInsertDirectorWithoutName(self):
     db = MovieDatabase()
     db.Connect()
     self.assertTrue(db.InsertDirector(15632, None, "nm12344321"),
                     msg="testInsertDirectorRightInput")
     db.DisConnect()