def test_get_status_counts(self): expected_steps = ['teams', 'waiting', 'done', 'cancelled'] # Initially, counts for all expected steps should be 0 initial_counts = team_api.get_status_counts('test course', 'test item') for step in expected_steps: assert {'status': step, 'count': 0} in initial_counts # Given some assessments self._create_test_workflow('foo', 'teams') self._create_test_workflow('bar', 'waiting') self._create_test_workflow('baz', 'done') self._create_test_workflow('biz', 'cancelled') # When we get updated counts counts = team_api.get_status_counts('test course', 'test item') for step in expected_steps: assert {'status': step, 'count': 1} in counts
def get_team_workflow_status_counts(self): """ Retrieve the counts of team workflows for each status. Returns: tuple of (list, int), where the list contains dicts with keys "status" (unicode value) and "count" (int value), and the integer represents the total number of submissions. """ student_item = self.get_student_item_dict() status_counts = team_workflow_api.get_status_counts( course_id=student_item['course_id'], item_id=student_item['item_id'], ) num_submissions = sum(item['count'] for item in status_counts) return status_counts, num_submissions