def test_get_films_in_tv2(self): """ Tests situation when there are showtimes in the given country """ self.initialize() time_now = datetime.datetime.utcnow() + datetime.timedelta(0.1) self.screen_tvp1 = Screening(channel=self.tvp, film=self.fc1, utc_time=time_now) self.screen_tvp1.save() self.screen_tvp2 = Screening(channel=self.tvp, film=self.fc2, utc_time=time_now) self.screen_tvp2.save() self.screen_tvp3 = Screening(channel=self.tvp, film=self.fc3, utc_time=time_now) self.screen_tvp3.save() self.screen_tvp4 = Screening(channel=self.tvp, film=self.fc4, utc_time=time_now) self.screen_tvp4.save() self.screen_tvp5 = Screening(channel=self.tvp, film=self.fc5, utc_time=datetime.datetime.utcnow() + datetime.timedelta(8)) self.screen_tvp5.save() country_films = set([f.id for f in \ get_films_in_tv_by_country(country_code='PL')]) self.assertTrue(self.f1.id in country_films) self.assertTrue(self.f4.id in country_films) self.assertTrue(self.f5.id not in country_films)
def test_get_films_in_tv1(self): """ Tests situation when there are no showtimes in the given country """ self.initialize() country_films = set([f.id for f in \ get_films_in_tv_by_country(country_code='CR')]) self.assertTrue(self.f1.id in country_films) self.assertTrue(self.f4.id in country_films) self.assertTrue(self.f5.id not in country_films)