Ejemplo n.º 1
0
    def test_has_missing_file(self):
        with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
            library = Library(db)
            self.assertFalse(library.has_missing_file)
            os.rename('tests/library/2 Guns.avi', 'tests/library/Two Guns.avi')

        with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
            library = Library(db)
            self.assertTrue(library.has_missing_file)
            os.rename('tests/library/Two Guns.avi', 'tests/library/2 Guns.avi')
Ejemplo n.º 2
0
 def test_effective_size(self):
     with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
         library = Library(db)
         movie = Movie(2, u"a", 'b', 1, 2, 2.2, 'd', 1, 'e', '/test')
         movie.exist = False
         library._update_library(movie)
         self.assertEqual(library.effective_size, self._effective_size)
         movie.exist = True
         movie.matched = True
         library._update_library(movie)
         self.assertEqual(library.effective_size, self._effective_size + 2)
Ejemplo n.º 3
0
 def test_iter(self):
     with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
         library = Library(db)
         self.assertEqual(type(library.__iter__()).__name__, 'generator')
         m = library.__iter__().next()
         self.assertEqual(m.__class__.__name__, 'Movie')
Ejemplo n.º 4
0
 def test_update_library(self):
     with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
         library = Library(db)
         movie = Movie(1, u"a", 'b', 1, 2, 2.2, 'd', 1, 'e', '/test')
         library._update_library(movie)
         self.assertEqual(len(library), self._nb_movie + 1)
Ejemplo n.º 5
0
 def test_init(self):
     with database.Database(database_override='./tests/database/com.plexapp.plugins.library.db') as db:
         library = Library(db)
         self.assertEqual(len(library), self._nb_movie)