class TestWeeklyChart(unittest.TestCase): @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/weekly_chart.yaml') def setUp(self): self.bom = BOM(WEEKLY_CHART) self.movies = self.bom.get_chart() self.test_movie = self.movies.next() # get the first movie for testing def test_weekly_chart(self): """ Tests if BOM holds appropriate Movie objects """ assert type(self.test_movie.rank) == str assert type(self.test_movie.title) == str assert type(self.test_movie.studio) == str assert type(self.test_movie.gross) == str assert "$" in self.test_movie.gross @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/weekly_trend.yaml') def test_weekly_trend(self): """ Tests for the weekend trend of a movie """ for movie in self.movies: trend_data = movie.get_trend(WEEKLY_CHART) assert len(trend_data) > 0 assert type(trend_data) == list for data in trend_data: assert type(data) == tuple
class TestDailyChart(unittest.TestCase): @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/daily_chart.yaml') def setUp(self): self.bom = BOM() self.movies = self.bom.get_chart() self.test_movie = self.movies.next() # get the first movie for testing def test_daily_chart(self): """ Tests if BOM holds appropriate Movie objects """ assert type(self.test_movie.rank) == str assert type(self.test_movie.title) == str assert type(self.test_movie.studio) == str assert type(self.test_movie.gross) == str assert "$" in self.test_movie.gross temp_gross = self.test_movie.gross self.test_movie.gross = '-' assert type(self.test_movie.gross_val) == int assert self.test_movie.gross_val == 0 self.test_movie.gross = temp_gross @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/daily_trend.yaml') def test_daily_trend(self): """ Tests for the daily trend of a movie """ for movie in self.movies: trend_data = movie.get_trend() assert len(trend_data) > 0 assert type(trend_data) == list for data in trend_data: assert type(data) == tuple
class TestBOM(unittest.TestCase): @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/bom.yaml') def setUp(self): self.bom = BOM() self.movies = self.bom.get_chart() def test_bom(self): assert type(self.bom.date) == str
class TestMovie(unittest.TestCase): #@vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/movie.yaml') def setUp(self): self.bom = BOM() self.movies = self.bom.get_chart() self.test_movie = self.movies.next() # get the first movie for testing def test_movie(self): assert (urllib2.urlopen(self.test_movie.url)) assert type(self.test_movie.gross_val) == int
class TestMovie(unittest.TestCase): # @vcr.use_cassette(FIXTURES_DIR + '/vcr_cassettes/movie.yaml') def setUp(self): self.bom = BOM() self.movies = self.bom.get_chart() self.test_movie = self.movies.next() # get the first movie for testing def test_movie(self): assert urllib2.urlopen(self.test_movie.url) assert type(self.test_movie.gross_val) == int