def test_two_users_with_cases(self): me = User.objects.create(username='******') him = User.objects.create(username='******') Case.objects.create(owner=me) Case.objects.create(owner=me) Case.objects.create(owner=him) Case.objects.create(owner=him) Case.objects.create(owner=him) cases_me = Case.get_by_user(me) cases_him = Case.get_by_user(him) self.assertEqual(2, len(cases_me)) self.assertEqual(3, len(cases_him))
def step_for_user(request): """ Return a map of step -> count for the given users cases """ step_map = Case.count_by_step(request.user) return Response(step_map)
def test_user_should_have_one_case(self): me = User.objects.create(username='******') step = ProcessStep.create("Test") Case.objects.create(owner=me, step=step) cases = Case.get_by_user(me) self.assertEqual(1, len(cases))
def test_user_should_have_two_cases(self): me = User.objects.create(username='******') Case.objects.create(owner=me) Case.objects.create(owner=me) cases = Case.get_by_user(me) self.assertEqual(2, len(cases))