Beispiel #1
0
    def test_extractAllMovies(self):
        cte = Constans()
        fm = FolderManagement()
        directory = cte.FAKE_FILMS_PATH

        numberOfMoviesTotal = len(fm.getAllMoviesInTheDirectory(directory))
        self.assertEqual(numberOfMoviesTotal, 190,"There is no all the movies of the directory in the list {a}".format(a=numberOfMoviesTotal))
Beispiel #2
0
    def test_refreshRepositoryAdding(self):
        io = IOEngine()
        cte = Constans()
        fm = FolderManagement()
        repository = 'FAKE'

        io.refreshRepositoryAdding(repository)
Beispiel #3
0
    def test_getMovieList(self):
        cte = Constans()
        fm = FolderManagement()
        directory = cte.FAKE_FILMS_PATH
        path, dirs, files = next(os.walk(directory))

        numberOfMovies = len(fm.getMovieList(directory))
        self.assertEqual(numberOfMovies,len(files)-1,"There is no all the movies of the directory in the list {a}".format(a=numberOfMovies))
Beispiel #4
0
    def test_refreshRepositoryDeleting(self):
        io = IOEngine()
        cte = Constans()
        fm = FolderManagement()
        db = DBService()
        repository = 'FAKE'
        table = table = 'FILMS_FAKE'

        io.refreshRepositoryDeleting(repository)
        filmOut = db.checkIfIsIn('RAN', table)
        self.assertEqual(0, filmOut, "The record should'n exist")
Beispiel #5
0
from main.core.FolderManagement import FolderManagement
from main.db.DBService import DBService
from main.common.Constants import Constans

cte = Constans()
fm = FolderManagement()
db = DBService()


class IOEngine():
    def refreshRepositoryDeleting(self, repository):

        if repository == 'FAKE':
            table = cte.FILMS_FAKE
            directory = cte.FAKE_FILMS_PATH
        else:
            table = cte.FILMS_MAIN
            directory = cte.MAIN_FILMS_PATH

        recordedMovieList = db.getAllFilms(table)
        movieList = fm.getAllMoviesInTheDirectory(directory)

        for record in recordedMovieList:
            if record not in movieList:
                db.deleteFilm(record, table)

    def refreshRepositoryAdding(self, repository):

        if repository == 'FAKE':
            table = cte.FILMS_FAKE
            directory = cte.FAKE_FILMS_PATH