Пример #1
0
    def testHasCreatedOrModifiedTask(self):
        """Tests profile_logic.hasCreatedOrModifiedTask."""
        student_properties = {'is_student': True, 'scope': self.program}
        student = seeder_logic.seed(GCIProfile, student_properties)

        mentor_properties = {
            'mentor_for': [self.foo_org.key()],
            'is_mentor': True,
            'scope': self.program
        }
        foo_mentor = seeder_logic.seed(GCIProfile, mentor_properties)
        bar_mentor = seeder_logic.seed(GCIProfile, mentor_properties)

        # Task is modified and created by another mentor.
        task_utils.seedTask(self.program,
                            self.foo_org, [bar_mentor.key()],
                            student=student,
                            status=task_model.CLAIMED,
                            modified_by=bar_mentor,
                            created_by=bar_mentor)
        self.assertFalse(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

        # Task is created by another mentor, but modified by given mentor.
        task_utils.seedTask(self.program,
                            self.foo_org, [bar_mentor.key()],
                            student=student,
                            status=task_model.CLAIMED,
                            modified_by=foo_mentor,
                            created_by=bar_mentor)
        self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

        # Task is created by the given mentor, but modified by another mentor.
        task_utils.seedTask(self.program,
                            self.foo_org, [bar_mentor.key()],
                            student=student,
                            status=task_model.CLAIMED,
                            modified_by=bar_mentor,
                            created_by=foo_mentor)
        self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

        # Task is modified and created by the given mentor.
        task_utils.seedTask(self.program,
                            self.foo_org, [bar_mentor.key()],
                            student=student,
                            status=task_model.CLAIMED,
                            modified_by=foo_mentor,
                            created_by=foo_mentor)

        self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))
Пример #2
0
  def testHasCreatedOrModifiedTask(self):
    """Tests profile_logic.hasCreatedOrModifiedTask."""
    student_properties = {'is_student': True, 'scope': self.program}
    student = seeder_logic.seed(GCIProfile, student_properties)

    mentor_properties = {
        'mentor_for': [self.foo_org.key()],
        'is_mentor': True,
        'scope': self.program
        }
    foo_mentor = seeder_logic.seed(GCIProfile, mentor_properties)
    bar_mentor = seeder_logic.seed(GCIProfile, mentor_properties)

    # Task is modified and created by another mentor.
    task_utils.seedTask(
        self.program, self.foo_org, [bar_mentor.key()], student=student,
        status=task_model.CLAIMED, modified_by=bar_mentor,
        created_by=bar_mentor)
    self.assertFalse(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

    # Task is created by another mentor, but modified by given mentor.
    task_utils.seedTask(
        self.program, self.foo_org, [bar_mentor.key()], student=student,
        status=task_model.CLAIMED, modified_by=foo_mentor,
        created_by=bar_mentor)
    self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

    # Task is created by the given mentor, but modified by another mentor.
    task_utils.seedTask(
        self.program, self.foo_org, [bar_mentor.key()], student=student,
        status=task_model.CLAIMED, modified_by=bar_mentor,
        created_by=foo_mentor)
    self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))

    # Task is modified and created by the given mentor.
    task_utils.seedTask(
        self.program, self.foo_org, [bar_mentor.key()], student=student,
        status=task_model.CLAIMED, modified_by=foo_mentor,
        created_by=foo_mentor)

    self.assertTrue(profile_logic.hasCreatedOrModifiedTask(foo_mentor))
  def context(self, data, check, mutator):
    profile = data.url_profile

    return {
        'page_name': 'Moderate delete account requests',
        'profile': profile,
        'has_tasks': profile_logic.hasTasks(profile),
        'has_created_or_modified_tasks': profile_logic.hasCreatedOrModifiedTask(
            profile),
        'has_task_comments': profile_logic.hasTaskComments(profile),
        'has_other_gci_profiles': profile_logic.hasOtherGCIProfiles(profile),
        'has_other_gsoc_profiles': profile_logic.hasOtherGSoCProfiles(profile),
        }
    def context(self, data, check, mutator):
        profile = data.url_profile

        return {
            'page_name':
            'Moderate delete account requests',
            'profile':
            profile,
            'has_tasks':
            profile_logic.hasTasks(profile),
            'has_created_or_modified_tasks':
            profile_logic.hasCreatedOrModifiedTask(profile),
            'has_task_comments':
            profile_logic.hasTaskComments(profile),
            'has_other_gci_profiles':
            profile_logic.hasOtherGCIProfiles(profile),
            'has_other_gsoc_profiles':
            profile_logic.hasOtherGSoCProfiles(profile),
        }