def test_creation_with_fresh_banner(self): tmpdir = unicode(tempfile.mkdtemp()) tmpfile = '{0}/banner_123.jpg'.format(tmpdir) shutil.copyfile('tests/image1.jpg',tmpfile) tvShow = tvShowSchedule.tvShowSchedule(seriesid=123,bannerDir=tmpdir,autoComplete=True,verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1,episode=1,status=0,nextUpdate=datetime.datetime.now(),info={'seriesname':'Lost'}) self.assertIsInstance(tvShow,tvShowSchedule.tvShowSchedule) self.assertTrue(tvShow['info']['banner']) self.assertTrue(os.path.isfile(tmpfile)) self.assertEqual(LogTestCase.md5(tmpfile),LogTestCase.md5('tests/image1.jpg')) self.assertFalse(httpretty.has_request()) os.remove(tmpfile) shutil.rmtree(tmpdir)
def test_creation_with_new_banner_dl(self,mock_getmtime): mock_getmtime.return_value=time.mktime((datetime.datetime.now() - datetime.timedelta(days=45)).timetuple()) tmpdir = unicode(tempfile.mkdtemp()) tmpfile = '{0}/banner_123.jpg'.format(tmpdir) tvShow = tvShowSchedule.tvShowSchedule(seriesid=123,bannerDir=tmpdir,autoComplete=True,verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1,episode=1,status=0,nextUpdate=datetime.datetime.now(),info={'seriesname':'Lost'}) self.assertIsInstance(tvShow,tvShowSchedule.tvShowSchedule) self.assertTrue(tvShow['info']['banner']) self.assertTrue(os.path.isfile(tmpfile)) self.assertEqual(LogTestCase.md5(tmpfile),LogTestCase.md5('tests/image.jpg')) self.assertTrue(httpretty.has_request()) os.remove(tmpfile) shutil.rmtree(tmpdir)
def test_creation_with_fresh_banner(self): tmpdir = unicode(tempfile.mkdtemp()) tmpfile = '{0}/banner_123.jpg'.format(tmpdir) shutil.copyfile('tests/image1.jpg', tmpfile) tvShow = tvShowSchedule.tvShowSchedule(seriesid=123, bannerDir=tmpdir, autoComplete=True, verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1, episode=1, status=0, nextUpdate=datetime.datetime.now(), info={'seriesname': 'Lost'}) self.assertIsInstance(tvShow, tvShowSchedule.tvShowSchedule) self.assertTrue(tvShow['info']['banner']) self.assertTrue(os.path.isfile(tmpfile)) self.assertEqual(LogTestCase.md5(tmpfile), LogTestCase.md5('tests/image1.jpg')) self.assertFalse(httpretty.has_request()) os.remove(tmpfile) shutil.rmtree(tmpdir)
def test_creation_with_new_banner_dl(self, mock_getmtime): mock_getmtime.return_value = time.mktime( (datetime.datetime.now() - datetime.timedelta(days=45)).timetuple()) tmpdir = unicode(tempfile.mkdtemp()) tmpfile = '{0}/banner_123.jpg'.format(tmpdir) tvShow = tvShowSchedule.tvShowSchedule(seriesid=123, bannerDir=tmpdir, autoComplete=True, verbosity=DEBUG_TVSHOWSCHEDULE) tvShow.set(season=1, episode=1, status=0, nextUpdate=datetime.datetime.now(), info={'seriesname': 'Lost'}) self.assertIsInstance(tvShow, tvShowSchedule.tvShowSchedule) self.assertTrue(tvShow['info']['banner']) self.assertTrue(os.path.isfile(tmpfile)) self.assertEqual(LogTestCase.md5(tmpfile), LogTestCase.md5('tests/image.jpg')) self.assertTrue(httpretty.has_request()) os.remove(tmpfile) shutil.rmtree(tmpdir)