def testAcceptProposalButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({ 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/accept/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) # fail if mentor tries to accept the proposal self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertFalse(proposal.accept_as_project) # accept the proposal as project when the org admin tries to accept # the proposal self.data.createOrgAdmin(self.org) response = self.post(url, postdata) self.assertResponseOK(response) proposal = GSoCProposal.all().get() self.assertTrue(proposal.accept_as_project)
def testFeaturedProjectButton(self): self.timeline.studentsAnnounced() student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() self.data.createOrgAdmin(self.org) mentor = GSoCProfileHelper(self.gsoc, self.dev_test) mentor.createOtherUser('*****@*****.**') mentor_entity = mentor.createMentor(self.org) project = self.createProject({'parent': self.data.profile, 'mentor': mentor_entity}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), self.data.user.key().name(), project.key().id()) url = '/gsoc/project/featured/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseOK(response) project = GSoCProject.all().get() self.assertEqual(project.is_featured, True)
def testAcceptProposalButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/accept/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) # fail if mentor tries to accept the proposal self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertFalse(proposal.accept_as_project) # accept the proposal as project when the org admin tries to accept # the proposal self.data.createOrgAdmin(self.org) response = self.post(url, postdata) self.assertResponseOK(response) proposal = GSoCProposal.all().get() self.assertTrue(proposal.accept_as_project)
def testFeaturedProjectButton(self): self.timeline.studentsAnnounced() student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() self.data.createOrgAdmin(self.org) mentor = GSoCProfileHelper(self.gsoc, self.dev_test) mentor.createOtherUser('*****@*****.**') mentor_entity = mentor.createMentor(self.org) project = self.createProject({ 'parent': self.data.profile, 'mentor': mentor_entity }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), self.data.user.key().name(), project.key().id()) url = '/gsoc/project/featured/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseOK(response) project = GSoCProject.all().get() self.assertEqual(project.is_featured, True)
def testReviewProposalPublicView(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({'is_publicly_visible': True, 'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) # test review GET url = '/gsoc/proposal/review/' + suffix response = self.get(url) self.assertGSoCTemplatesUsed(response) self.assertTemplateUsed(response, 'v2/modules/gsoc/proposal/review.html')
def testWishToMentorButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() self.data.createMentor(self.org) other_mentor = self.createMentorWithSettings( '*****@*****.**') proposal = self.createProposal({ 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) url = '/gsoc/proposal/wish_to_mentor/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) proposal = GSoCProposal.all().get() self.assertTrue(self.data.profile.key() in proposal.possible_mentors) postdata = {'value': 'checked'} response = self.post(url, postdata) proposal = GSoCProposal.all().get() self.assertFalse(self.data.profile.key() in proposal.possible_mentors) other_mentor.profile.mentor_for = [] other_mentor.profile.put() proposal.possible_mentors.append(other_mentor.profile.key()) proposal.put() url = '/gsoc/proposal/review/' + suffix response = self.get(url) proposal = GSoCProposal.all().get() self.assertFalse( other_mentor.profile.key() in proposal.possible_mentors)
def testReviewProposalPublicView(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({ 'is_publicly_visible': True, 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) # test review GET url = '/gsoc/proposal/review/' + suffix response = self.get(url) self.assertGSoCTemplatesUsed(response) self.assertTemplateUsed(response, 'v2/modules/gsoc/proposal/review.html')
def testWishToMentorButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() self.data.createMentor(self.org) other_mentor = self.createMentorWithSettings('*****@*****.**') proposal = self.createProposal({'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) url = '/gsoc/proposal/wish_to_mentor/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) proposal = GSoCProposal.all().get() self.assertTrue(self.data.profile.key() in proposal.possible_mentors) postdata = {'value': 'checked'} response = self.post(url, postdata) proposal = GSoCProposal.all().get() self.assertFalse(self.data.profile.key() in proposal.possible_mentors) other_mentor.profile.mentor_for = [] other_mentor.profile.put() proposal.possible_mentors.append(other_mentor.profile.key()) proposal.put() url = '/gsoc/proposal/review/' + suffix response = self.get(url) proposal = GSoCProposal.all().get() self.assertFalse(other_mentor.profile.key() in proposal.possible_mentors)
def testCreateEvaluationForMentor(self): link_id = LinkIDProvider(ProjectSurvey).getValue() suffix = "%s/%s" % (self.gsoc.key().name(), link_id) student_profile = GSoCProfileHelper(self.gsoc, self.dev_test) student_profile.createOtherUser('*****@*****.**') student = student_profile.createStudent() self.data.createMentorWithProject(self.org, student) # test review GET url = '/gsoc/eval/student/edit/' + suffix response = self.get(url) self.assertResponseForbidden(response)
def testAssignMentor(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({ 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/assign_mentor/' + suffix postdata = {'assign_mentor': self.data.profile.key()} response = self.post(url, postdata) self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertEqual(proposal.mentor, None)
def testIgnoreProposalButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({ 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/ignore/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertNotEqual(proposal.status, 'ignored')
def testIgnoreProposalButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/ignore/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertNotEqual(proposal.status, 'ignored')
def testAssignMentor(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/assign_mentor/' + suffix postdata = {'assign_mentor': self.data.profile.key()} response = self.post(url, postdata) self.assertResponseForbidden(response) proposal = GSoCProposal.all().get() self.assertEqual(proposal.mentor, None)
def testProposalModificationButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({ 'scope': student.profile, 'parent': student.profile }) suffix = "%s/%s/%d" % (self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/modification/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseOK(response) proposal = GSoCProposal.all().get() self.assertTrue(proposal.is_editable_post_deadline)
def testProposalModificationButton(self): student = GSoCProfileHelper(self.gsoc, self.dev_test) student.createOtherUser('*****@*****.**') student.createStudent() proposal = self.createProposal({'scope': student.profile, 'parent': student.profile}) suffix = "%s/%s/%d" % ( self.gsoc.key().name(), student.user.key().name(), proposal.key().id()) self.data.createMentor(self.org) url = '/gsoc/proposal/modification/' + suffix postdata = {'value': 'unchecked'} response = self.post(url, postdata) self.assertResponseOK(response) proposal = GSoCProposal.all().get() self.assertTrue(proposal.is_editable_post_deadline)
def createStudent(self, email, program): profile_helper = GSoCProfileHelper(program, dev_test=False) profile_helper.createOtherUser(email) student = profile_helper.createStudent() return student