Esempio n. 1
0
  def testWithdrawProposalTwice(self):
    # try to withdraw the proposal twice
    proposal_logic.withdrawProposal(self.proposal, self.student)
    result = proposal_logic.withdrawProposal(self.proposal, self.student)

    # the result should also be true but number of proposals should not
    # be decreased twice
    self.assertTrue(result)
    self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
    self.assertEqual(self.student.student_data.number_of_proposals, 0)
Esempio n. 2
0
    def testWithdrawProposalTwice(self):
        # try to withdraw the proposal twice
        proposal_logic.withdrawProposal(self.proposal, self.student)
        result = proposal_logic.withdrawProposal(self.proposal, self.student)

        # the result should also be true but number of proposals should not
        # be decreased twice
        self.assertTrue(result)
        self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
        self.assertEqual(self.student.student_data.number_of_proposals, 0)
Esempio n. 3
0
  def testWithdrawProposal(self):
    # try to withdraw the proposal
    result = proposal_logic.withdrawProposal(self.proposal, self.student)

    # the proposal should be withdrawn
    self.assertTrue(result)
    self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
    self.assertEqual(self.student.student_data.number_of_proposals, 0)
Esempio n. 4
0
    def testWithdrawProposal(self):
        # try to withdraw the proposal
        result = proposal_logic.withdrawProposal(self.proposal, self.student)

        # the proposal should be withdrawn
        self.assertTrue(result)
        self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
        self.assertEqual(self.student.student_data.number_of_proposals, 0)
Esempio n. 5
0
def withdrawProposalTxn(proposal_key, profile_key):
    """Withdraws the specified proposal in a transaction.

  Args:
    proposal_key: Proposal key.
    student_info_key: Student info key of the student who owns the proposal.
  """
    proposal = db.get(proposal_key)
    profile = profile_key.get()
    return proposal_logic.withdrawProposal(proposal, profile)
Esempio n. 6
0
def withdrawProposalTxn(proposal_key, profile_key):
  """Withdraws the specified proposal in a transaction.

  Args:
    proposal_key: Proposal key.
    student_info_key: Student info key of the student who owns the proposal.
  """
  proposal = db.get(proposal_key)
  profile = profile_key.get()
  return proposal_logic.withdrawProposal(proposal, profile)
Esempio n. 7
0
  def testForIneligibleProposal(self):
    # set the proposal status to accepted
    self.proposal.status = proposal_model.STATUS_ACCEPTED
    self.proposal.put()

    # try to withdraw the proposal
    result = proposal_logic.withdrawProposal(self.proposal, self.student)

    # the proposal should not be withdrawn
    self.assertFalse(result)
    self.assertEqual(proposal_model.STATUS_ACCEPTED, self.proposal.status)
    self.assertEqual(1, self.student.student_data.number_of_proposals)
Esempio n. 8
0
  def testWithdrawProposalForStudentWithFewProposals(self):
    # create a few other proposals
    for _ in range(3):
      proposal_utils.seedProposal(self.student.key, self.program.key())

    # withdraw the main proposal
    result = proposal_logic.withdrawProposal(self.proposal, self.student)

    # the proposal should be withdrawn
    self.assertTrue(result)
    self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
    self.assertEqual(3, self.student.student_data.number_of_proposals)
Esempio n. 9
0
    def testForIneligibleProposal(self):
        # set the proposal status to accepted
        self.proposal.status = proposal_model.STATUS_ACCEPTED
        self.proposal.put()

        # try to withdraw the proposal
        result = proposal_logic.withdrawProposal(self.proposal, self.student)

        # the proposal should not be withdrawn
        self.assertFalse(result)
        self.assertEqual(proposal_model.STATUS_ACCEPTED, self.proposal.status)
        self.assertEqual(1, self.student.student_data.number_of_proposals)
Esempio n. 10
0
    def testWithdrawProposalForStudentWithFewProposals(self):
        # create a few other proposals
        for _ in range(3):
            proposal_utils.seedProposal(self.student.key, self.program.key())

        # withdraw the main proposal
        result = proposal_logic.withdrawProposal(self.proposal, self.student)

        # the proposal should be withdrawn
        self.assertTrue(result)
        self.assertEqual(proposal_model.STATUS_WITHDRAWN, self.proposal.status)
        self.assertEqual(3, self.student.student_data.number_of_proposals)