예제 #1
0
 def test_exclude_submission_rounds(self):
     create_submission(created_by=self.user, phase=self.development,
                       phase_round=self.round_a)
     self.assertEqual(Submission.objects.eligible(self.development,
                                                  self.round_a).count(), 1)
     self.assertEqual((Submission.objects.eligible(self.development,
                                                   self.round_b).count()), 0)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
예제 #2
0
 def test_exclude_submission_version(self):
     submission_ideation = create_submission(created_by=self.user,
                                             phase=self.ideation)
     new_sub = create_submission(title='Replacement', created_by=self.user,
                                 phase=self.development, with_parent=False)
     submission_ideation.parent.update_version(new_sub)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
     self.assertEqual(Submission.objects.eligible(self.development).count(), 1)
 def test_exclude_submission_rounds(self):
     create_submission(created_by=self.user,
                       phase=self.development,
                       phase_round=self.round_a)
     self.assertEqual(
         Submission.objects.eligible(self.development,
                                     self.round_a).count(), 1)
     self.assertEqual((Submission.objects.eligible(
         self.development, self.round_b).count()), 0)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
 def test_exclude_submission_version(self):
     submission_ideation = create_submission(created_by=self.user,
                                             phase=self.ideation)
     new_sub = create_submission(title='Replacement',
                                 created_by=self.user,
                                 phase=self.development,
                                 with_parent=False)
     submission_ideation.parent.update_version(new_sub)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
     self.assertEqual(
         Submission.objects.eligible(self.development).count(), 1)
예제 #5
0
 def generate_submissions(self, total, phase, user=None, are_winners=True):
     """Generates a nubmer of submissions"""
     for i in range(total):
         user = user if user else create_user('u%s' % i),
         yield create_submission(title='Submission %s' % i,
                                 created_by=user, phase=phase,
                                 is_winner=are_winners)
 def setUp(self):
     super(SubmissionEditIdeationOpenAnonTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.submission = create_submission(created_by=self.profile,
                                         phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', self.submission.parent.slug])
예제 #7
0
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.profile = create_user('bob')
     self.submission = create_submission(created_by=self.profile,
                                         phase=self.initial_data['ideation_phase'])
     self.parent = self.submission.parent
     self.submission_path = self.submission.get_absolute_url()
예제 #8
0
 def setUp(self):
     self.profile = create_user('bob')
     self.url = reverse('create_entry', args=['ideas'])
     self.initial_data = setup_development_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.submission_kwargs = {
         'created_by': self.profile,
         'phase': self.ideation,
         'is_winner': True
     }
     self.submission_a = create_submission(title='ping',
                                           **self.submission_kwargs)
     self.submission_b = create_submission(title='pong',
                                           **self.submission_kwargs)
     self.search_url = reverse('search:search')
예제 #9
0
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.profile = create_user('bob')
     self.submission = create_submission(
         created_by=self.profile, phase=self.initial_data['ideation_phase'])
     self.parent = self.submission.parent
     self.submission_path = self.submission.get_absolute_url()
예제 #10
0
 def setUp(self):
     self.profile = create_user('bob')
     self.url = reverse('create_entry', args=['ideas'])
     self.initial_data = setup_development_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.submission_kwargs = {
         'created_by': self.profile,
         'phase': self.ideation,
         'is_winner': True
         }
     self.submission_a = create_submission(title='ping',
                                           **self.submission_kwargs)
     self.submission_b = create_submission(title='pong',
                                           **self.submission_kwargs)
     self.search_url = reverse('search:search')
 def setUp(self):
     super(SubmissionEditIdeationOpenAnonTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.submission = create_submission(
         created_by=self.profile, phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', self.submission.parent.slug])
 def setUp(self):
     super(SubmissionEditDevelopmentOpenAnonTest, self).setUp()
     initial_data = setup_development_rounds_phase(**setup_ignite_challenge())
     self.submission = create_submission(created_by=self.profile,
                                         phase=initial_data['dev_phase'],
                                         phase_round=initial_data['round_b'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', self.submission.parent.slug])
 def generate_submissions(self, total, phase, user=None, are_winners=True):
     """Generates a nubmer of submissions"""
     for i in range(total):
         user = user if user else create_user('u%s' % i)
         yield create_submission(title='Submission %s' % i,
                                 created_by=user,
                                 phase=phase,
                                 is_winner=are_winners)
 def setUp(self):
     super(SubmissionEditIdeationOpenTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.category = initial_data['category']
     self.submission = create_submission(created_by=self.profile,
                                         phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', self.submission.parent.slug])
     self.client.login(username='******', password='******')
 def setUp(self):
     super(SubmissionEditIdeationOpenTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.category = initial_data['category']
     self.submission = create_submission(
         created_by=self.profile, phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', self.submission.parent.slug])
     self.client.login(username='******', password='******')
 def setUp(self):
     super(SubmissionEditIdeationOpenNotOwnerTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     other = create_user('other')
     submission = create_submission(created_by=other,
                                    phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', submission.parent.slug])
     self.client.login(username='******', password='******')
 def setUp(self):
     super(SubmissionEditIdeationOpenNotOwnerTest, self).setUp()
     initial_data = setup_ideation_phase(**setup_ignite_challenge())
     other = create_user('other')
     submission = create_submission(created_by=other,
                                    phase=initial_data['ideation_phase'])
     self.edit_url = reverse('entry_edit',
                             args=['ideas', submission.parent.slug])
     self.client.login(username='******', password='******')
예제 #18
0
 def test_timeslot_listing_non_greenlit(self):
     """Test the ``TimeSlot`` when ``Submissions`` aren't green lit"""
     non_lit = create_submission(title='Submission B',
                                 created_by=self.profile,
                                 phase=self.ideation)
     # Booking time tables are only available for winner entries
     self.client.login(username='******', password='******')
     response = self.client.get(reverse('timeslot:object_list',
                                        args=[non_lit.id]))
     self.assertEqual(response.status_code, 404)
 def test_timeslot_listing_non_greenlit(self):
     """Test the ``TimeSlot`` when ``Submissions`` aren't green lit"""
     non_lit = create_submission(title='Submission B',
                                 created_by=self.profile,
                                 phase=self.ideation)
     # Booking time tables are only available for winner entries
     self.client.login(username='******', password='******')
     response = self.client.get(
         reverse('timeslot:object_list', args=[non_lit.id]))
     self.assertEqual(response.status_code, 404)
예제 #20
0
 def test_different_phase_search(self):
     """Archive a submission and search again"""
     submission_a_fork = create_submission(title='Brand new',
                                           with_parent=False,
                                           **self.submission_kwargs)
     self.submission_a.parent.update_version(submission_a_fork)
     response = self.client.get(self.search_url+ '?q=ping')
     self.assertEqual(response.context['page'].paginator.count, 0)
     response = self.client.get(self.search_url+ '?q=brand')
     self.assertEqual(response.context['page'].paginator.count, 1)
 def setUp(self):
     super(SubmissionEditDevelopmentClosedRoundAnonTests, self).setUp()
     initial_data = setup_development_phase(is_round_open=False,
                                            **setup_ignite_challenge())
     self.submission = create_submission(
         created_by=self.profile,
         phase=initial_data['dev_phase'],
         phase_round=initial_data['round_a'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', self.submission.parent.slug])
예제 #22
0
 def test_different_phase_search(self):
     """Archive a submission and search again"""
     submission_a_fork = create_submission(title='Brand new',
                                           with_parent=False,
                                           **self.submission_kwargs)
     self.submission_a.parent.update_version(submission_a_fork)
     response = self.client.get(self.search_url + '?q=ping')
     self.assertEqual(response.context['page'].paginator.count, 0)
     response = self.client.get(self.search_url + '?q=brand')
     self.assertEqual(response.context['page'].paginator.count, 1)
 def setUp(self):
     super(SubmissionEditDevelopmentOpenNotOwnerTest, self).setUp()
     initial_data = setup_development_rounds_phase(**setup_ignite_challenge())
     other = create_user('other')
     submission = create_submission(created_by=other,
                                    phase=initial_data['dev_phase'],
                                    phase_round=initial_data['round_b'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', submission.parent.slug])
     self.client.login(username='******', password='******')
 def setUp(self):
     super(SubmissionEditDevelopmentClosedRoundNotOnwerTests, self).setUp()
     initial_data = setup_development_phase(is_round_open=False,
                                            **setup_ignite_challenge())
     other = create_user('other')
     submission = create_submission(created_by=other,
                                    phase=initial_data['dev_phase'],
                                    phase_round=initial_data['round_a'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', submission.parent.slug])
     self.client.login(username='******', password='******')
예제 #25
0
 def setUp(self):
     super(AwardAmountIdeationClosedTest, self).setUp()
     self.initial_data = setup_ideation_phase(is_open=False,
                                              **setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.submission = create_submission(created_by=self.user,
                                         phase=self.ideation,
                                         is_winner=False)
     self.award_url = reverse('awards:award', args=[self.submission.id])
     self.phase_award = self.create_phase_award(phase=self.ideation)
예제 #26
0
 def setUp(self):
     super(AwardAmountIdeationClosedTest, self).setUp()
     self.initial_data = setup_ideation_phase(is_open=False,
                                              **setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.submission = create_submission(created_by=self.user,
                                         phase=self.ideation,
                                         is_winner=False)
     self.award_url = reverse('awards:award', args=[self.submission.id])
     self.phase_award = self.create_phase_award(phase=self.ideation)
예제 #27
0
 def setUp(self):
     super(InvalidAwardsTests, self).setUp()
     self.initial_data = setup_development_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.round_a = self.initial_data['round_a']
     self.submission = create_submission(created_by=self.user,
                                         phase=self.ideation,
                                         is_winner=True)
     self.award_url = reverse('awards:award', args=[self.submission.id])
     self.phase_award = self.create_phase_award(phase=self.development)
예제 #28
0
 def setUp(self):
     super(InvalidAwardsTests, self).setUp()
     self.initial_data = setup_development_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     self.round_a = self.initial_data['round_a']
     self.submission = create_submission(created_by=self.user,
                                         phase=self.ideation,
                                         is_winner=True)
     self.award_url = reverse('awards:award', args=[self.submission.id])
     self.phase_award = self.create_phase_award(phase=self.development)
예제 #29
0
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.profile = create_user('bob')
     self.submission = create_submission(created_by=self.profile,
                                         phase=self.initial_data['ideation_phase'])
     self.view_path = self.submission.get_absolute_url()
     self.edit_path = self.submission.get_edit_url()
     ExternalLink.objects.create(submission=self.submission, name='Foo',
                                 url='http://example.com/')
     ExternalLink.objects.create(submission=self.submission, name='Foo',
                                 url='http://example.net/')
     self.client.login(username='******', password='******')
예제 #30
0
 def test_timeslot_booking_non_greenlit(self):
     """Test ``TimeSlots`` bookings on non-green-lit ``Submissions``"""
     non_lit = create_submission(title='Submission B',
                                 created_by=self.profile,
                                 phase=self.ideation)
     # Booking time tables are only available for winner entries
     self.client.login(username='******', password='******')
     url = self.get_booking_url(non_lit.id, self.t1.short_id)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 405)
     response = self.client.post(url, {})
     self.assertEqual(response.status_code, 404)
 def test_timeslot_booking_non_greenlit(self):
     """Test ``TimeSlots`` bookings on non-green-lit ``Submissions``"""
     non_lit = create_submission(title='Submission B',
                                 created_by=self.profile,
                                 phase=self.ideation)
     # Booking time tables are only available for winner entries
     self.client.login(username='******', password='******')
     url = self.get_booking_url(non_lit.id, self.t1.short_id)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 405)
     response = self.client.post(url, {})
     self.assertEqual(response.status_code, 404)
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     super(TimeSlotIdeationTest, self).setUp()
     self.submission = create_submission(created_by=self.profile,
                                         phase=self.ideation,
                                         is_winner=True)
     self.listing_url = reverse('timeslot:object_list',
                                args=[self.submission.id])
     self.t1, self.t2 = self.generate_timeslots(2, self.ideation)
     self.booking_url = reverse('timeslot:object_detail',
                                args=[self.submission.id, self.t1.short_id])
 def setUp(self):
     super(SubmissionEditDevelopmentClosedRoundTests, self).setUp()
     initial_data = setup_development_phase(is_round_open=False,
                                            **setup_ignite_challenge())
     category = initial_data['category']
     self.valid_data = self._get_valid_data(category=category.id,
                                            repository_url='http://mozilla.com')
     self.submission = create_submission(created_by=self.profile,
                                         phase=initial_data['dev_phase'],
                                         phase_round=initial_data['round_a'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', self.submission.parent.slug])
     self.client.login(username='******', password='******')
 def setUp(self):
     super(SubmissionEditDevelopmentClosedRoundTests, self).setUp()
     initial_data = setup_development_phase(is_round_open=False,
                                            **setup_ignite_challenge())
     category = initial_data['category']
     self.valid_data = self._get_valid_data(
         category=category.id, repository_url='http://mozilla.com')
     self.submission = create_submission(
         created_by=self.profile,
         phase=initial_data['dev_phase'],
         phase_round=initial_data['round_a'])
     self.edit_url = reverse('entry_edit',
                             args=['apps', self.submission.parent.slug])
     self.client.login(username='******', password='******')
예제 #35
0
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.profile = create_user('bob')
     self.submission = create_submission(
         created_by=self.profile, phase=self.initial_data['ideation_phase'])
     self.view_path = self.submission.get_absolute_url()
     self.edit_path = self.submission.get_edit_url()
     ExternalLink.objects.create(submission=self.submission,
                                 name='Foo',
                                 url='http://example.com/')
     ExternalLink.objects.create(submission=self.submission,
                                 name='Foo',
                                 url='http://example.net/')
     self.client.login(username='******', password='******')
예제 #36
0
 def setUp(self):
     self.initial_data = setup_ideation_phase(**setup_ignite_challenge())
     self.ideation = self.initial_data['ideation_phase']
     self.development = self.initial_data['dev_phase']
     super(TimeSlotIdeationTest, self).setUp()
     self.submission = create_submission(created_by=self.profile,
                                         phase=self.ideation,
                                         is_winner=True)
     self.listing_url = reverse('timeslot:object_list',
                                args=[self.submission.id])
     self.t1, self.t2 = self.generate_timeslots(2, self.ideation)
     self.booking_url = reverse('timeslot:object_detail',
                                args=[self.submission.id,
                                      self.t1.short_id])
 def setUp(self):
     super(SubmissionEditDevelopmentOpenTest, self).setUp()
     self.initial_data = setup_development_rounds_phase(**setup_ignite_challenge())
     category = self.initial_data['category']
     self.valid_data = self._get_valid_data(category=category.id,
                                            repository_url='http://mozilla.com',
                                            blog_url='http://blog.mozilla.com')
     del self.valid_data['terms_and_conditions']
     # Create a proposal ``Submission`` on the open ``PhaseRound``
     self.submission = create_submission(
         created_by=self.profile,
         phase=self.initial_data['dev_phase'],
         phase_round=self.initial_data['round_b'])
     self.edit_url = self._get_edit_url(self.submission.parent.slug)
     self.client.login(username='******', password='******')
 def test_development_edit_post_new_round(self):
     SubmissionParent.objects.get().delete()
     submission = create_submission(created_by=self.profile,
                                    phase=self.initial_data['dev_phase'],
                                    phase_round=self.initial_data['round_a'])
     edit_url = self._get_edit_url(submission.parent.slug)
     self.valid_data.update(BLANK_EXTERNALS)
     response = self.client.post(edit_url, self.valid_data)
     self.assertRedirects(response, submission.get_absolute_url())
     parent = SubmissionParent.objects.get()
     version_list = parent.submissionversion_set.all()
     eq_(len(version_list), 1)
     eq_(version_list[0].submission, submission)
     eq_(parent.submission.phase, self.initial_data['dev_phase'])
     eq_(parent.submission.phase_round, self.initial_data['round_b'])
 def test_development_edit_post_new_round(self):
     SubmissionParent.objects.get().delete()
     submission = create_submission(
         created_by=self.profile,
         phase=self.initial_data['dev_phase'],
         phase_round=self.initial_data['round_a'])
     edit_url = self._get_edit_url(submission.parent.slug)
     self.valid_data.update(BLANK_EXTERNALS)
     response = self.client.post(edit_url, self.valid_data)
     self.assertRedirects(response, submission.get_absolute_url())
     parent = SubmissionParent.objects.get()
     version_list = parent.submissionversion_set.all()
     eq_(len(version_list), 1)
     eq_(version_list[0].submission, submission)
     eq_(parent.submission.phase, self.initial_data['dev_phase'])
     eq_(parent.submission.phase_round, self.initial_data['round_b'])
 def setUp(self):
     super(SubmissionEditDevelopmentOpenTest, self).setUp()
     self.initial_data = setup_development_rounds_phase(
         **setup_ignite_challenge())
     category = self.initial_data['category']
     self.valid_data = self._get_valid_data(
         category=category.id,
         repository_url='http://mozilla.com',
         blog_url='http://blog.mozilla.com')
     del self.valid_data['terms_and_conditions']
     # Create a proposal ``Submission`` on the open ``PhaseRound``
     self.submission = create_submission(
         created_by=self.profile,
         phase=self.initial_data['dev_phase'],
         phase_round=self.initial_data['round_b'])
     self.edit_url = self._get_edit_url(self.submission.parent.slug)
     self.client.login(username='******', password='******')
예제 #41
0
 def test_judge_overfound(self):
     self.client.login(username='******', password='******')
     self.submission.is_winner = True
     self.submission.save()
     self.create_allowance()
     data = {'amount': 6000}
     response = self.client.post(self.award_url, data, follow=True)
     self.assertRedirects(response, self.submission.get_absolute_url())
     for item in list(response.context['messages']):
         self.assertEqual(item.tags, 'success')
     other_submission = create_submission(title='other-submission',
                                          created_by=self.user,
                                          phase=self.ideation,
                                          is_winner= True)
     other_url = reverse('awards:award', args=[other_submission.id])
     response = self.client.post(other_url, data, follow=True)
     self.assertRedirects(response, other_submission.get_absolute_url())
     self.assertTrue('messages' in response.context)
     for item in list(response.context['messages']):
         self.assertEqual(item.tags, 'error')
예제 #42
0
 def test_judge_overfound(self):
     self.client.login(username='******', password='******')
     self.submission.is_winner = True
     self.submission.save()
     self.create_allowance()
     data = {'amount': 6000}
     response = self.client.post(self.award_url, data, follow=True)
     self.assertRedirects(response, self.submission.get_absolute_url())
     for item in list(response.context['messages']):
         self.assertEqual(item.tags, 'success')
     other_submission = create_submission(title='other-submission',
                                          created_by=self.user,
                                          phase=self.ideation,
                                          is_winner=True)
     other_url = reverse('awards:award', args=[other_submission.id])
     response = self.client.post(other_url, data, follow=True)
     self.assertRedirects(response, other_submission.get_absolute_url())
     self.assertTrue('messages' in response.context)
     for item in list(response.context['messages']):
         self.assertEqual(item.tags, 'error')
예제 #43
0
 def test_exclude_drafts(self):
     create_submission(created_by=self.user, phase=self.ideation, is_draft=True)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
 def test_invalid_idea_edit_on_development_post(self):
     idea = create_submission(created_by=self.profile,
                              phase=self.initial_data['ideation_phase'])
     response = self.client.post(self._get_edit_url(idea.parent.slug),
                                 self.valid_data)
     eq_(response.status_code, 404)
예제 #45
0
 def test_exclude_submission_phases(self):
     create_submission(created_by=self.user, phase=self.ideation)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 1)
     self.assertEqual(Submission.objects.eligible(self.development).count(), 0)
     self.assertEqual(Submission.objects.count(), 1)
 def test_invalid_idea_edit_on_development_post(self):
     idea = create_submission(created_by=self.profile,
                              phase=self.initial_data['ideation_phase'])
     response = self.client.post(self._get_edit_url(idea.parent.slug),
                                 self.valid_data)
     eq_(response.status_code, 404)
 def test_exclude_drafts(self):
     create_submission(created_by=self.user,
                       phase=self.ideation,
                       is_draft=True)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 0)
 def test_exclude_submission_phases(self):
     create_submission(created_by=self.user, phase=self.ideation)
     self.assertEqual(Submission.objects.eligible(self.ideation).count(), 1)
     self.assertEqual(
         Submission.objects.eligible(self.development).count(), 0)
     self.assertEqual(Submission.objects.count(), 1)