def test_get_list_view(self): response = self.client.get(reverse('groups:list')) self.assertEqual(response.status_code, 200) self.assertIn('groups', response.context) groups = list(response.context['groups']) all_groups = Group.all() self.assertTrue(all(group in all_groups for group in groups))
def landingpage(request): user_ids = [s.user_id for s in SocialUser.all()] return render( request, 'landingpage.html', { 'video_count': len(list(Video.all())), 'group_count': len(list(Group.all())), 'socialuser_count': len(set(user_ids)), 'socialuser_all_count': len(user_ids), 'overall_suggestions_count': statistics.overall_suggestions_count(), 'overall_suggestions_user_count': statistics.overall_suggestions_user_count(), 'suggestions_user_count': statistics.suggestions_user_count(), 'overall_watch_count': statistics.overall_watch_count(), 'overall_watch_user_count': statistics.overall_watch_user_count(), 'watch_user_count': statistics.watch_user_count(), 'overall_dismiss_count': statistics.overall_dismiss_count(), 'overall_dismiss_user_count': statistics.overall_dismiss_user_count(), 'dismiss_user_count': statistics.dismiss_user_count(), 'user_watches': statistics.user_watches(), })
def test_post_delete_view(self): group = Group.get(1) response = self.client.post(reverse('groups:delete', kwargs={'pk': group.id}), follow=True) self.assertRedirects(response, reverse('groups:list')) self.assertNotIn(group, Group.all())