Ejemplo n.º 1
0
 def test_amount_allocated_new_submission(self):
     allowance = self.create_allowance()
     self.award(self.submission, 4000, allowance)
     other = create_submission('Other Submission', self.user, self.phase)
     self.award(other, 400, allowance)
     new_sub = create_submission('New Submission', self.user, self.phase)
     amount_used = allowance.get_amount_used(new_sub)
     self.assertEqual(amount_used, 4400)
Ejemplo n.º 2
0
 def setUp(self):
     # Ignite fixtures are setup on the BadgesBaseTest
     super(BadgesSubmissionTest, self).setUp()
     self.badge_a = self.create_badge()
     self.badge_b = self.create_badge(body="Award")
     self.user = create_user("bob")
     self.submission = create_submission("Hello", self.user, self.ideation)
 def setUp(self):
     # Ignite fixtures are setup on the BadgesBaseTest
     super(BadgesSubmissionTest, self).setUp()
     self.badge_a = self.create_badge()
     self.badge_b = self.create_badge(body='Award')
     self.user = create_user('bob')
     self.submission = create_submission('Hello', self.user, self.ideation)
Ejemplo n.º 4
0
 def setUp(self):
     self.judge = create_user('bob')
     project = create_project('A project')
     challenge = create_challenge('A challenge', project)
     self.phase = create_phase('A phase', challenge)
     self.user = create_user('alex')
     self.submission = create_submission('A submission', self.user,
                                         self.phase)
     self.phase_award = Award.objects.create(phase=self.phase,
                                             amount=10000)
 def create_submission_badge(self):
     """Creates a ``SubmissionBadge``"""
     data = {
         'badge_type': Badge.GREEN_LIT,
         'body': 'On the badge',
         }
     badge = Badge.objects.create(**data)
     bob = create_user('bob')
     submission = create_submission('Lorem Ipsum', bob, self.ideation)
     submission_badge = Submission.objects.create(badge=badge,
                                                  submission=submission)
     assert submission_badge.id, "Submission Badge creation failed"
     self.assertEqual(submission_badge.text, 'On the badge')
     submission_badge.body = 'Set on the submission'
     self.assertEqual(submission_badge.text, 'Set on the submission')
Ejemplo n.º 6
0
 def test_not_enough_allowance(self):
     allowance = self.create_allowance()
     self.award(self.submission, 9000, allowance)
     other = create_submission('Other submission', self.user, self.phase)
     self.assertFalse(allowance.can_award(10000, other))
Ejemplo n.º 7
0
 def test_allocate_other_failure(self):
     allowance = self.create_allowance()
     self.assertTrue(allowance.allocate(9000, self.submission))
     other = create_submission('Other Submission', self.user, self.phase)
     self.assertFalse(allowance.allocate(1001, other))