def test_redirects_to_visible_event(self): EventFactory.create_batch(4, visible=False) visible_event = EventFactory(visible=True) self.client.force_login(UserFactory()) response = self.client.get("/") self.assertRedirects( response, visible_event.get_absolute_url(), status_code=302 )
def test_redirects_to_latest_event(self): EventFactory.create_batch(4, event_end=now() + timedelta(days=24)) latest_event = EventFactory(event_end=now() + timedelta(days=50)) self.client.force_login(UserFactory()) response = self.client.get("/") self.assertRedirects(response, latest_event.get_absolute_url(), status_code=302)