Пример #1
0
  def setUp(self):
    super(ManageInviteTest, self).setUp()
    self.init()

    self.invitee = self._invitee()
    self.invite = GCIInviteHelper().createOrgAdminInvite(
        self.org, self.invitee.user)
Пример #2
0
  def testSecondInviteForbidden(self):
    self.data.createOrgAdmin(self.org)
    invitee = self._invitee()

    GCIInviteHelper().createMentorInvite(self.org, invitee.user)

    post_data = {
        'identifiers': invitee.user.link_id,
        }
    response = self.post(self._inviteMentorUrl(), post_data)
    self.assertResponseOK(response)
    self._assertFormValidationError(response, 'identifiers')
Пример #3
0
  def testOrgAdminInviteAfterMentorInvite(self):
    self.data.createOrgAdmin(self.org)
    invitee = self._invitee()

    GCIInviteHelper().createMentorInvite(self.org, invitee.user)

    post_data = {
        'identifiers': invitee.user.link_id,
        }
    response = self.post(self._inviteOrgAdminUrl(), post_data)
    self.assertResponseRedirect(response,
        '/gci/dashboard/%s' % self.gci.key().name())

    invite = GCIRequest.all().filter('role =', 'org_admin').get()
    self.assertPropertiesEqual(self._defaultOrgAdminInviteProperties(), invite)
Пример #4
0
  def testMentorInviteAfterOrgAdminInvite(self):
    # TODO(dhans): this test should fail in the future:
    # a existing mentor invite should be extended to become org_admin one

    self.data.createOrgAdmin(self.org)
    invitee = self._invitee()

    GCIInviteHelper().createOrgAdminInvite(self.org, invitee.user)

    post_data = {
        'identifiers': invitee.user.link_id,
        }
    response = self.post(self._inviteMentorUrl(), post_data)
    self.assertResponseRedirect(response,
        '/gci/dashboard/%s' % self.gci.key().name())

    invite = GCIRequest.all().filter('role =', 'mentor').get()
    self.assertPropertiesEqual(self._defaultMentorInviteProperties(), invite)