Пример #1
0
    def testRequestMentor(self):
        admin = GSoCProfileHelper(self.gsoc, self.dev_test)
        admin.createOtherUser('*****@*****.**')
        admin.createOrgAdmin(self.org)
        admin.notificationSettings(new_requests=True)

        other_admin = GSoCProfileHelper(self.gsoc, self.dev_test)
        other_admin.createOtherUser('*****@*****.**')
        other_admin.createOrgAdmin(self.org)
        other_admin.notificationSettings()

        # test GET
        self.data.createProfile()
        url = '/gsoc/request/' + self.org.key().name()
        response = self.get(url)
        self.assertRequestTemplatesUsed(response)

        # test POST
        override = {
            'status': 'pending',
            'role': 'mentor',
            'type': 'Request',
            'user': self.data.user,
            'org': self.org
        }
        response, properties = self.modelPost(url, GSoCRequest, override)

        request = GSoCRequest.all().get()
        self.assertPropertiesEqual(properties, request)

        self.assertEmailSent(to=admin.profile.email, n=1)
        self.assertEmailNotSent(to=other_admin.profile.email)

        # test withdrawing a request
        url = '/gsoc/request/%s/%s/%s' % (self.gsoc.key().name(),
                                          request.parent_key().name(),
                                          request.key().id())

        postdata = {'action': 'Withdraw'}
        response = self.post(url, postdata)
        self.assertResponseRedirect(response)
        request = GSoCRequest.all().get()
        self.assertEqual('withdrawn', request.status)

        # test that you can resubmit
        postdata = {'action': 'Resubmit'}
        response = self.post(url, postdata)
        self.assertResponseRedirect(response)
        request = GSoCRequest.all().get()
        self.assertEqual('pending', request.status)
Пример #2
0
 def createOrgAdmin(self, email, organization):
   """Creates an organization admin for the given organization.
   """
   profile_helper = GSoCProfileHelper(self.program, dev_test=False)
   profile_helper.createOtherUser(email)
   admin = profile_helper.createOrgAdmin(organization)
   return admin
Пример #3
0
 def createOrgAdmin(self, email, organization):
     """Creates an organization admin for the given organization.
 """
     profile_helper = GSoCProfileHelper(self.program, dev_test=False)
     profile_helper.createOtherUser(email)
     admin = profile_helper.createOrgAdmin(organization)
     return admin
Пример #4
0
  def testRequestMentor(self):
    admin = GSoCProfileHelper(self.gsoc, self.dev_test)
    admin.createOtherUser('*****@*****.**')
    admin.createOrgAdmin(self.org)
    admin.notificationSettings(new_requests=True)

    other_admin = GSoCProfileHelper(self.gsoc, self.dev_test)
    other_admin.createOtherUser('*****@*****.**')
    other_admin.createOrgAdmin(self.org)
    other_admin.notificationSettings()

    # test GET
    self.data.createProfile()
    url = '/gsoc/request/' + self.org.key().name()
    response = self.get(url)
    self.assertRequestTemplatesUsed(response)

    # test POST
    override = {'status': 'pending', 'role': 'mentor', 'type': 'Request',
                'user': self.data.user, 'org': self.org}
    response, properties = self.modelPost(url, GSoCRequest, override)

    request = GSoCRequest.all().get()
    self.assertPropertiesEqual(properties, request)

    self.assertEmailSent(to=admin.profile.email, n=1)
    self.assertEmailNotSent(to=other_admin.profile.email)

    # test withdrawing a request
    url = '/gsoc/request/%s/%s/%s' % (
        self.gsoc.key().name(),
        request.parent_key().name(),
        request.key().id())

    postdata = {'action': 'Withdraw'}
    response = self.post(url, postdata)
    self.assertResponseRedirect(response)
    request = GSoCRequest.all().get()
    self.assertEqual('withdrawn', request.status)

    # test that you can resubmit
    postdata = {'action': 'Resubmit'}
    response = self.post(url, postdata)
    self.assertResponseRedirect(response)
    request = GSoCRequest.all().get()
    self.assertEqual('pending', request.status)
Пример #5
0
    def testRequestMentor(self):
        admin = GSoCProfileHelper(self.gsoc, self.dev_test)
        admin.createOtherUser("*****@*****.**")
        admin.createOrgAdmin(self.org)
        admin.notificationSettings(new_requests=True)

        other_admin = GSoCProfileHelper(self.gsoc, self.dev_test)
        other_admin.createOtherUser("*****@*****.**")
        other_admin.createOrgAdmin(self.org)
        other_admin.notificationSettings()

        # test GET
        self.data.createProfile()
        url = "/gsoc/request/" + self.org.key().name()
        response = self.get(url)
        self.assertRequestTemplatesUsed(response)

        # test POST
        override = {"status": "pending", "role": "mentor", "type": "Request", "user": self.data.user, "org": self.org}
        response, properties = self.modelPost(url, GSoCRequest, override)

        request = GSoCRequest.all().get()
        self.assertPropertiesEqual(properties, request)

        self.assertEmailSent(to=admin.profile.email, n=1)
        self.assertEmailNotSent(to=other_admin.profile.email)

        # test withdrawing a request
        url = "/gsoc/request/%s/%s" % (self.gsoc.key().name(), request.key().id())

        postdata = {"action": "Withdraw"}
        response = self.post(url, postdata)
        self.assertResponseRedirect(response)
        request = GSoCRequest.all().get()
        self.assertEqual("withdrawn", request.status)

        # test that you can resubmit
        postdata = {"action": "Resubmit"}
        response = self.post(url, postdata)
        self.assertResponseRedirect(response)
        request = GSoCRequest.all().get()
        self.assertEqual("pending", request.status)