Пример #1
0
class SurveyRemindersTest(
    test_utils.GSoCDjangoTestCase, test_utils.TaskQueueTestCase):
  """Tests for accept_proposals task.
  """

  SPAWN_URL = '/tasks/gsoc/surveys/send_reminder/spawn'
  SEND_URL = '/tasks/gsoc/surveys/send_reminder/send'

  def setUp(self):
    super(SurveyRemindersTest, self).setUp()
    self.init()

    self.mentor = profile_utils.seedNDBProfile(
        self.program.key(), mentor_for=[self.org.key])
    self.student = profile_utils.seedNDBStudent(self.program)
    self.project = project_utils.seedProject(
        self.student, self.program.key(), org_key=self.org.key,
        mentor_key=self.mentor.key)

    self.createSurveys()

  def createSurveys(self):
    """Creates the surveys and records required for the tests in the old
    format.
    """
    user = profile_utils.seedNDBUser()
    survey_values = {
        'author': user.key.to_old_key(),
        'title': 'Title',
        'modified_by': user.key.to_old_key(),
        'link_id': 'link_id',
        'scope': self.program,
        'survey_start': timeline_utils.past(),
        'survey_end': timeline_utils.past(),
    }

    self.project_survey = ProjectSurvey(
        key_name='key_name', **survey_values)
    self.project_survey.put()

    self.grading_survey = GradingProjectSurvey(
        key_name='key_name', **survey_values)
    self.grading_survey.put()

  def testSpawnSurveyRemindersForProjectSurvey(self):
    """Test spawning reminder tasks for a ProjectSurvey."""
    post_data = {
        'program_key': self.program.key().id_or_name(),
        'survey_key': self.project_survey.key().id_or_name(),
        'survey_type': 'project'
        }

    response = self.post(self.SPAWN_URL, post_data)

    self.assertResponseOK(response)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

  def testSpawnSurveyRemindersForGradingSurvey(self):
    """Test spawning reminder tasks for a GradingProjectSurvey."""
    post_data = {
        'program_key': self.program.key().id_or_name(),
        'survey_key': self.grading_survey.key().id_or_name(),
        'survey_type': 'grading'
        }

    response = self.post(self.SPAWN_URL, post_data)

    self.assertResponseOK(response)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

  def testSendSurveyReminderForProjectSurvey(self):
    """Test sending out a reminder for a ProjectSurvey."""
    post_data = {
        'survey_key': self.project_survey.key().id_or_name(),
        'survey_type': 'project',
        'project_key': str(self.project.key())
        }

    response = self.post(self.SEND_URL, post_data)

    self.assertResponseOK(response)
    # URL explicitly added since the email task is in there
    self.assertTasksInQueue(n=0, url=self.SEND_URL)
    self.assertEmailSent(to=self.student.contact.email)
    # TODO(daniel): add assertEmailNotSent to DjangoTestCase
    #self.assertEmailNotSent(to=self.mentor.email)

  def testSendSurveyReminderForGradingSurvey(self):
    """Test sending out a reminder for a GradingProjectSurvey."""
    post_data = {
        'survey_key': self.grading_survey.key().id_or_name(),
        'survey_type': 'grading',
        'project_key': str(self.project.key())
        }

    response = self.post(self.SEND_URL, post_data)

    self.assertResponseOK(response)
    # URL explicitly added since the email task is in there
    self.assertTasksInQueue(n=0, url=self.SEND_URL)
    self.assertEmailSent(to=self.mentor.contact.email)
    # TODO(daniel): add assertEmailNotSent to DjangoTestCase
    #self.assertEmailNotSent(to=self.student.email)

  def testDoesNotSpawnProjectSurveyReminderForWithdrawnProject(self):
    """Test withdrawn projects don't spawn reminder tasks for
    student evaluation.

    This covers all the evaluations created (midterm and final).
    """
    # seed a withdrawn project
    student = profile_utils.seedNDBStudent(self.program)
    project_utils.seedProject(
        student, self.program.key(), org_key=self.org.key, status='withdrawn')

    post_data = {
        'program_key': self.gsoc.key().id_or_name(),
        'survey_key': self.project_survey.key().id_or_name(),
        'survey_type': 'project'
        }

    response = self.post(self.SPAWN_URL, post_data)

    self.assertResponseOK(response)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    # We have two projects in datastore and one is withdrawn, so we expect
    # to spawn the task for only one project.
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

  def testDoesNotGradingProjectSurveyReminderForWithdrawnProject(self):
    """Test withdrawn projects don't spawn reminder tasks for
    mentor evaluation.

    This covers all the evaluations created (midterm and final).
    """
    student = profile_utils.seedNDBStudent(self.program)
    project_utils.seedProject(
        student, self.program.key(), org_key=self.org.key, status='withdrawn')

    self.project.put()
    post_data = {
        'program_key': self.gsoc.key().id_or_name(),
        'survey_key': self.grading_survey.key().id_or_name(),
        'survey_type': 'grading'
        }

    response = self.post(self.SPAWN_URL, post_data)

    self.assertResponseOK(response)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    # We have two projects in datastore and one is withdrawn, so we expect
    # to spawn the task for only one project.
    self.assertTasksInQueue(n=1, url=self.SEND_URL)
class SurveyRemindersTest(MailTestCase, GSoCDjangoTestCase, TaskQueueTestCase):
    """Tests for accept_proposals task.
  """

    SPAWN_URL = '/tasks/gsoc/surveys/send_reminder/spawn'
    SEND_URL = '/tasks/gsoc/surveys/send_reminder/send'

    def setUp(self):
        super(SurveyRemindersTest, self).setUp()
        self.init()
        self.createMentor()
        self.createStudent()
        self.createSurveys()

    def createMentor(self):
        """Creates a new mentor.
    """
        profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
        profile_helper.createOtherUser('*****@*****.**')
        self.mentor = profile_helper.createMentor(self.org)

    def createStudent(self):
        """Creates a Student with a project.
    """
        profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
        profile_helper.createOtherUser('*****@*****.**')
        self.student = profile_helper.createStudentWithProject(
            self.org, self.mentor)
        self.project = GSoCProject.all().ancestor(self.student).get()

    def createSurveys(self):
        """Creates the surveys and records required for the tests in the old
    format.
    """
        survey_values = {
            'author': self.founder,
            'title': 'Title',
            'modified_by': self.founder,
            'link_id': 'link_id',
            'scope': self.gsoc,
            'scope_path': self.gsoc.key().id_or_name()
        }

        self.project_survey = ProjectSurvey(key_name='key_name',
                                            **survey_values)
        self.project_survey.put()

        self.grading_survey = GradingProjectSurvey(key_name='key_name',
                                                   **survey_values)
        self.grading_survey.put()

    def testSpawnSurveyRemindersForProjectSurvey(self):
        """Test spawning reminder tasks for a ProjectSurvey.
    """
        post_data = {
            'program_key': self.gsoc.key().id_or_name(),
            'survey_key': self.project_survey.key().id_or_name(),
            'survey_type': 'project'
        }

        response = self.post(self.SPAWN_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=2)
        self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
        self.assertTasksInQueue(n=1, url=self.SEND_URL)

    def testSpawnSurveyRemindersForGradingSurvey(self):
        """Test spawning reminder tasks for a GradingProjectSurvey.
    """
        post_data = {
            'program_key': self.gsoc.key().id_or_name(),
            'survey_key': self.grading_survey.key().id_or_name(),
            'survey_type': 'grading'
        }

        response = self.post(self.SPAWN_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=2)
        self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
        self.assertTasksInQueue(n=1, url=self.SEND_URL)

    def testSendSurveyReminderForProjectSurvey(self):
        """Test sending out a reminder for a ProjectSurvey.
    """
        post_data = {
            'survey_key': self.project_survey.key().id_or_name(),
            'survey_type': 'project',
            'project_key': str(self.project.key())
        }

        response = self.post(self.SEND_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        # URL explicitly added since the email task is in there
        self.assertTasksInQueue(n=0, url=self.SEND_URL)
        self.assertEmailSent(to=self.student.email)
        self.assertEmailNotSent(to=self.mentor.email)

    def testSendSurveyReminderForGradingSurvey(self):
        """Test sending out a reminder for a GradingProjectSurvey.
    """
        post_data = {
            'survey_key': self.grading_survey.key().id_or_name(),
            'survey_type': 'grading',
            'project_key': str(self.project.key())
        }

        response = self.post(self.SEND_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        # URL explicitly added since the email task is in there
        self.assertTasksInQueue(n=0, url=self.SEND_URL)
        self.assertEmailSent(to=self.mentor.email)
        self.assertEmailNotSent(to=self.student.email)
class GradingSurveyGroupTest(MailTestCase, GSoCDjangoTestCase,
                             TaskQueueTestCase):
    """Tests for accept_proposals task.
  """

    UPDATE_RECORDS_URL = '/tasks/gsoc/grading_record/update_records'
    UPDATE_PROJECTS_URL = '/tasks/gsoc/grading_record/update_projects'
    SEND_URL = '/tasks/gsoc/grading_record/mail_result'

    def setUp(self):
        super(GradingSurveyGroupTest, self).setUp()
        self.init()
        self.createMentor()
        self.createStudent()
        self.createSurveys()

    def createMentor(self):
        """Creates a new mentor.
    """
        profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
        profile_helper.createOtherUser('*****@*****.**')
        self.mentor = profile_helper.createMentor(self.org)

    def createStudent(self):
        """Creates a Student with a project.
    """
        profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
        profile_helper.createOtherUser('*****@*****.**')
        self.student = profile_helper.createStudentWithProject(
            self.org, self.mentor)
        self.project = GSoCProject.all().ancestor(self.student).get()

    def createSurveys(self):
        """Creates the surveys and records required for the tests.
    """
        survey_values = {
            'author': self.founder,
            'title': 'Title',
            'modified_by': self.founder,
            'link_id': 'link_id',
            'scope': self.gsoc,
            'scope_path': self.gsoc.key().id_or_name()
        }

        self.project_survey = ProjectSurvey(key_name='key_name',
                                            **survey_values)
        self.project_survey.put()

        self.grading_survey = GradingProjectSurvey(key_name='key_name',
                                                   **survey_values)
        self.grading_survey.put()

        record_values = {
            'user': self.student.user,
            'org': self.org,
            'project': self.project,
            'survey': self.project_survey
        }
        self.project_survey_record = GSoCProjectSurveyRecord(**record_values)
        self.project_survey_record.put()

        self.grading_survey = GradingProjectSurvey(**survey_values)
        self.grading_survey.put()

        record_values = {
            'user': self.student.user,
            'org': self.org,
            'project': self.project,
            'survey': self.grading_survey,
            'grade': True
        }
        self.grading_survey_record = GSoCGradingProjectSurveyRecord(
            **record_values)
        self.grading_survey_record.put()

        group_values = {
            'name': 'Survey Group Name',
            'grading_survey': self.grading_survey,
            'student_survey': self.project_survey,
            'program': self.gsoc
        }
        self.survey_group = GSoCGradingSurveyGroup(**group_values)
        self.survey_group.put()

        record_values = {
            'grading_survey_group': self.survey_group,
            'mentor_record': self.grading_survey_record,
            'student_record': self.project_survey_record,
            'grade_decision': 'pass'
        }
        self.grading_record = GSoCGradingRecord(parent=self.project,
                                                **record_values)
        self.grading_record.put()

    def testCreateGradingRecord(self):
        """Test creating a GradingRecord.
    """
        self.grading_record.delete()

        post_data = {'group_key': self.survey_group.key().id_or_name()}

        response = self.post(self.UPDATE_RECORDS_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=1, url=self.UPDATE_RECORDS_URL)

        record = GSoCGradingRecord.all().get()
        self.assertFalse(record is None)
        self.assertEqual(record.grade_decision, 'pass')

    def testUpdateGradingRecord(self):
        """Test updating a GradingRecord.
    """
        self.grading_record.grade_decision = 'undecided'
        self.grading_record.put()

        post_data = {'group_key': self.survey_group.key().id_or_name()}

        response = self.post(self.UPDATE_RECORDS_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=1, url=self.UPDATE_RECORDS_URL)

        record = GSoCGradingRecord.all().get()
        self.assertFalse(record is None)
        self.assertEqual(record.grade_decision, 'pass')

    def testUpdateProject(self):
        """Test updating a Project with a GradingRecord's result.
    """
        post_data = {
            'group_key': self.survey_group.key().id_or_name(),
        }

        response = self.post(self.UPDATE_PROJECTS_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=1, url=self.UPDATE_PROJECTS_URL)

        project = GSoCProject.all().get()
        self.assertFalse(project is None)
        self.assertEqual(project.passed_evaluations,
                         [self.grading_record.key()])
        self.assertEqual(1, project.parent().student_info.passed_evaluations)

    def testUpdateProjectWithSendMail(self):
        """Test updating a Project with a GradingRecord's result and sending mail.
    """
        post_data = {
            'group_key': self.survey_group.key().id_or_name(),
            'send_mail': True,
        }

        response = self.post(self.UPDATE_PROJECTS_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        self.assertTasksInQueue(n=1, url=self.UPDATE_PROJECTS_URL)
        self.assertTasksInQueue(n=1, url=self.SEND_URL)

        project = GSoCProject.all().get()
        self.assertFalse(project is None)
        self.assertEqual(project.passed_evaluations,
                         [self.grading_record.key()])
        self.assertEqual(1, project.parent().student_info.passed_evaluations)

    def testSendMail(self):
        """Test sending mail about a GradingRecord's result.
    """
        post_data = {'record_key': str(self.grading_record.key())}

        response = self.post(self.SEND_URL, post_data)

        self.assertEqual(response.status_code, httplib.OK)
        # URL explicitly added since the email task is in there
        self.assertTasksInQueue(n=0, url=self.SEND_URL)
        self.assertEmailSent(to=self.student.email)
Пример #4
0
class SurveyRemindersTest(MailTestCase, GSoCDjangoTestCase, TaskQueueTestCase):
  """Tests for accept_proposals task.
  """

  SPAWN_URL = '/tasks/gsoc/surveys/send_reminder/spawn'
  SEND_URL = '/tasks/gsoc/surveys/send_reminder/send'

  def setUp(self):
    super(SurveyRemindersTest, self).setUp()
    self.init()
    self.createMentor()
    self.createStudent()
    self.createSurveys()

  def createMentor(self):
    """Creates a new mentor.
    """
    profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
    profile_helper.createOtherUser('*****@*****.**')
    self.mentor = profile_helper.createMentor(self.org)

  def createStudent(self):
    """Creates a Student with a project.
    """
    profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
    profile_helper.createOtherUser('*****@*****.**')
    self.student = profile_helper.createStudentWithProject(self.org,
                                                           self.mentor)
    self.project = GSoCProject.all().ancestor(self.student).get()

  def createSurveys(self):
    """Creates the surveys and records required for the tests in the old
    format.
    """
    survey_values = {
        'author': self.founder,
        'title': 'Title',
        'modified_by': self.founder,
        'link_id': 'link_id',
        'scope': self.gsoc,
        'scope_path': self.gsoc.key().id_or_name()}

    self.project_survey = ProjectSurvey(key_name='key_name',
                                        **survey_values)
    self.project_survey.put()

    self.grading_survey = GradingProjectSurvey(key_name='key_name',
                                               **survey_values)
    self.grading_survey.put()

  def testSpawnSurveyRemindersForProjectSurvey(self):
    """Test spawning reminder tasks for a ProjectSurvey.
    """
    post_data = {
        'program_key': self.gsoc.key().id_or_name(),
        'survey_key': self.project_survey.key().id_or_name(),
        'survey_type': 'project'}

    response = self.post(self.SPAWN_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

  def testSpawnSurveyRemindersForGradingSurvey(self):
    """Test spawning reminder tasks for a GradingProjectSurvey.
    """
    post_data = {
        'program_key': self.gsoc.key().id_or_name(),
        'survey_key': self.grading_survey.key().id_or_name(),
        'survey_type': 'grading'}

    response = self.post(self.SPAWN_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=2)
    self.assertTasksInQueue(n=1, url=self.SPAWN_URL)
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

  def testSendSurveyReminderForProjectSurvey(self):
    """Test sending out a reminder for a ProjectSurvey.
    """
    post_data = {
        'survey_key': self.project_survey.key().id_or_name(),
        'survey_type': 'project',
        'project_key': str(self.project.key())}

    response = self.post(self.SEND_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    # URL explicitly added since the email task is in there
    self.assertTasksInQueue(n=0, url=self.SEND_URL)
    self.assertEmailSent(to=self.student.email)
    self.assertEmailNotSent(to=self.mentor.email)

  def testSendSurveyReminderForGradingSurvey(self):
    """Test sending out a reminder for a GradingProjectSurvey.
    """
    post_data = {
        'survey_key': self.grading_survey.key().id_or_name(),
        'survey_type': 'grading',
        'project_key': str(self.project.key())}

    response = self.post(self.SEND_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    # URL explicitly added since the email task is in there
    self.assertTasksInQueue(n=0, url=self.SEND_URL)
    self.assertEmailSent(to=self.mentor.email)
    self.assertEmailNotSent(to=self.student.email)
Пример #5
0
class GradingSurveyGroupTest(MailTestCase, GSoCDjangoTestCase, TaskQueueTestCase):
  """Tests for accept_proposals task.
  """

  UPDATE_RECORDS_URL = '/tasks/gsoc/grading_record/update_records'
  UPDATE_PROJECTS_URL = '/tasks/gsoc/grading_record/update_projects'
  SEND_URL = '/tasks/gsoc/grading_record/mail_result'

  def setUp(self):
    super(GradingSurveyGroupTest, self).setUp()
    self.init()
    self.createMentor()
    self.createStudent()
    self.createSurveys()

  def createMentor(self):
    """Creates a new mentor.
    """
    profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
    profile_helper.createOtherUser('*****@*****.**')
    self.mentor = profile_helper.createMentor(self.org)

  def createStudent(self):
    """Creates a Student with a project.
    """
    profile_helper = GSoCProfileHelper(self.gsoc, self.dev_test)
    profile_helper.createOtherUser('*****@*****.**')
    self.student = profile_helper.createStudentWithProject(self.org,
                                                           self.mentor)
    self.project = GSoCProject.all().ancestor(self.student).get()

  def createSurveys(self):
    """Creates the surveys and records required for the tests.
    """
    survey_values = {
        'author': self.founder,
        'title': 'Title',
        'modified_by': self.founder,
        'link_id': 'link_id',
        'scope': self.gsoc,
        'scope_path': self.gsoc.key().id_or_name()}

    self.project_survey = ProjectSurvey(key_name='key_name',
                                        **survey_values)
    self.project_survey.put()

    self.grading_survey = GradingProjectSurvey(key_name='key_name',
                                               **survey_values)
    self.grading_survey.put()

    record_values = {
        'user': self.student.user,
        'org': self.org,
        'project': self.project,
        'survey': self.project_survey}
    self.project_survey_record = GSoCProjectSurveyRecord(**record_values)
    self.project_survey_record.put()

    self.grading_survey = GradingProjectSurvey(**survey_values)
    self.grading_survey.put()

    record_values = {
        'user': self.student.user,
        'org': self.org,
        'project': self.project,
        'survey': self.grading_survey,
        'grade': True}
    self.grading_survey_record = GSoCGradingProjectSurveyRecord(
        **record_values)
    self.grading_survey_record.put()

    group_values = {
        'name': 'Survey Group Name',
        'grading_survey': self.grading_survey,
        'student_survey': self.project_survey,
        'program': self.gsoc}
    self.survey_group = GSoCGradingSurveyGroup(**group_values)
    self.survey_group.put()

    record_values = {
        'grading_survey_group': self.survey_group,
        'mentor_record': self.grading_survey_record,
        'student_record': self.project_survey_record,
        'grade_decision': 'pass'}
    self.grading_record = GSoCGradingRecord(parent=self.project,
                                            **record_values)
    self.grading_record.put()

  def testCreateGradingRecord(self):
    """Test creating a GradingRecord.
    """
    self.grading_record.delete()

    post_data = {
        'group_key': self.survey_group.key().id_or_name()
        }

    response = self.post(self.UPDATE_RECORDS_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=1, url=self.UPDATE_RECORDS_URL)

    record = GSoCGradingRecord.all().get()
    self.assertFalse(record is None)
    self.assertEqual(record.grade_decision, 'pass')

  def testUpdateGradingRecord(self):
    """Test updating a GradingRecord.
    """
    self.grading_record.grade_decision = 'undecided'
    self.grading_record.put()

    post_data = {
        'group_key': self.survey_group.key().id_or_name()
        }

    response = self.post(self.UPDATE_RECORDS_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=1, url=self.UPDATE_RECORDS_URL)

    record = GSoCGradingRecord.all().get()
    self.assertFalse(record is None)
    self.assertEqual(record.grade_decision, 'pass')

  def testUpdateProject(self):
    """Test updating a Project with a GradingRecord's result.
    """
    post_data = {
        'group_key': self.survey_group.key().id_or_name(),
        }

    response = self.post(self.UPDATE_PROJECTS_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=1, url=self.UPDATE_PROJECTS_URL)

    project = GSoCProject.all().get()
    self.assertFalse(project is None)
    self.assertEqual(project.passed_evaluations, [self.grading_record.key()])
    self.assertEqual(1, project.parent().student_info.passed_evaluations)

  def testUpdateProjectWithSendMail(self):
    """Test updating a Project with a GradingRecord's result and sending mail.
    """
    post_data = {
        'group_key': self.survey_group.key().id_or_name(),
        'send_mail': True,
        }

    response = self.post(self.UPDATE_PROJECTS_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    self.assertTasksInQueue(n=1, url=self.UPDATE_PROJECTS_URL)
    self.assertTasksInQueue(n=1, url=self.SEND_URL)

    project = GSoCProject.all().get()
    self.assertFalse(project is None)
    self.assertEqual(project.passed_evaluations, [self.grading_record.key()])
    self.assertEqual(1, project.parent().student_info.passed_evaluations)

  def testSendMail(self):
    """Test sending mail about a GradingRecord's result.
    """
    post_data = {
        'record_key': str(self.grading_record.key())
        }

    response = self.post(self.SEND_URL, post_data)

    self.assertEqual(response.status_code, httplib.OK)
    # URL explicitly added since the email task is in there
    self.assertTasksInQueue(n=0, url=self.SEND_URL)
    self.assertEmailSent(to=self.student.email)