def test_home_view_returns_context_data_with_hero_image(self): """Test home view returns context data with hero image.""" from imagersite.views import HomeView view = HomeView() data = view.get_context_data() self.assertIn('hero_img_url', data) self.assertEqual('High-Five', data['hero_img_title'])
def test_home_view_returns_context_with_photo_from_db(self): """Test that the homeview returns photo from db.""" from imagersite.views import HomeView user = UserFactory() user.set_password('password') user.save() photo = PhotoFactory(user=user, title='test', published='PUBLIC') photo.save() view = HomeView() data = view.get_context_data() self.assertIn('hero_img_url', data) self.assertEqual('test', data['hero_img_title'])