コード例 #1
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
  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)
コード例 #2
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
    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)
コード例 #3
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
  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)
コード例 #4
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
    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)
コード例 #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)
コード例 #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)
コード例 #7
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
  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)
コード例 #8
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
  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)
コード例 #9
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
    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)
コード例 #10
0
ファイル: test_proposal.py プロジェクト: rhyolight/nupic.son
    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)