def setUp(self):
        challenge_setup()
        user = User.objects.create_user('bob', '*****@*****.**', 'bob')
        create_submissions(1)

        self.phase = Phase.objects.get()
        self.submission = Submission.objects.get()
        self.judge = user.get_profile()
Exemple #2
0
 def setUp(self):
     challenge_setup()
     user = User.objects.create_user('bob', '*****@*****.**', 'bob')
     create_submissions(1)
     
     self.phase = Phase.objects.get()
     self.submission = Submission.objects.get()
     self.judge = user.get_profile()
 def setUp(self):
     challenge_setup()
     profile_list = create_users()
     self.phase = Phase.objects.all()[0]
     self.created_by = profile_list[0]
     self.category = Category.objects.all()[0]
     create_submissions(1, self.phase, self.created_by)
     self.submission_a = Submission.objects.get()
     self.parent = self.submission_a.parent
Exemple #4
0
 def setUp(self):
     challenge_setup()
     profile_list = create_users()
     self.phase = Phase.objects.all()[0]
     self.created_by = profile_list[0]
     self.category = Category.objects.all()[0]
     create_submissions(1, self.phase, self.created_by)
     self.submission_a = Submission.objects.get()
     self.parent = self.submission_a.parent
    def setUp(self):
        challenge_setup()
        create_users()
        alex_profile = User.objects.get(username='******').get_profile()
        create_submissions(5, creator=alex_profile)

        self.draft_submission = Submission.objects.all()[0]
        self.draft_submission.is_draft = True
        self.draft_submission.save()

        cache.clear()
Exemple #6
0
 def test_winning_entries(self):
     """Test the winning entries view."""
     create_submissions(5)
     winners = Submission.objects.all()[1:3]
     for entry in winners:
         entry.is_winner = True
         entry.save()
     
     response = self.client.get(reverse('entries_winning'))
     self.assertEqual(set(e.title for e in response.context['entries']),
                      set(e.title for e in winners))
Exemple #7
0
 def setUp(self):
     challenge_setup()
     create_users()
     alex_profile = User.objects.get(username='******').get_profile()
     create_submissions(5, creator=alex_profile)
     
     self.draft_submission = Submission.objects.all()[0]
     self.draft_submission.is_draft = True
     self.draft_submission.save()
     
     cache.clear()
Exemple #8
0
 def test_winning_entries(self):
     """Test the winning entries view."""
     create_submissions(5)
     winners = Submission.objects.all()[1:3]
     for entry in winners:
         entry.is_winner = True
         entry.save()
     response = self.client.get(reverse('entries_winning'))
     eq_(set(e.title for e in response.context['ideation_winners']),
         set(e.title for e in winners))
     assert_equal(len(response.context['development_winners']), 0)
 def test_splash_draft_entries(self):
     """Test draft entries aren't shown on the splash page."""
     create_submissions(3)
     submissions = Submission.objects.all()
     hidden = submissions[0]
     hidden.is_draft = True
     hidden.save()
     
     response = self.client.get(reverse('challenge_show'))
     self.assertEqual(set(response.context['entries']),
                      set(submissions[1:]))
Exemple #10
0
 def test_hidden_entries(self):
     """Test that draft entries are not visible on the entries page."""
     create_submissions(3)
     submissions = Submission.objects.all()
     hidden_submission = submissions[0]
     hidden_submission.is_draft = True
     hidden_submission.save()
     phase = Phase.objects.get()
     response = self.client.get(phase.get_absolute_url())
     # Check the draft submission is hidden
     assert_equal(set(response.context['entries'].object_list),
                  set(submissions[1:]))
Exemple #11
0
 def test_hidden_entries(self):
     """Test that draft entries are not visible on the entries page."""
     create_submissions(3)
     submissions = Submission.objects.all()
     hidden_submission = submissions[0]
     hidden_submission.is_draft = True
     hidden_submission.save()
     
     response = self.client.get(Challenge.objects.get().get_entries_url())
     # Check the draft submission is hidden
     assert_equal(set(response.context['entries'].object_list),
                  set(submissions[1:]))
Exemple #12
0
 def setUp(self):
     challenge_setup()
     create_users()
     
     alex_profile = User.objects.get(username='******').get_profile()
     create_submissions(1, creator=alex_profile)
     
     submission = Submission.objects.get()
     
     base_kwargs = {'project': Project.objects.get().slug,
                    'slug': Challenge.objects.get().slug}
     
     self.view_path = submission.get_absolute_url()
     self.delete_path = submission.get_delete_url()
Exemple #13
0
 def setUp(self):
     challenge_setup()
     profile_list = create_users()
     self.phase = Phase.objects.all()[0]
     self.alex = profile_list[0]
     self.category = Category.objects.all()[0]
     create_submissions(1, self.phase, self.alex)
     self.submission_a = Submission.objects.get()
     self.parent = self.submission_a.parent
     self.help_url = reverse('entry_help', args=[self.parent.slug])
     self.valid_data = {
         'notes': 'Help Wanted',
         'status': SubmissionHelp.PUBLISHED,
         }
Exemple #14
0
 def setUp(self):
     challenge_setup()
     profile_list = create_users()
     self.phase = Phase.objects.all()[0]
     self.alex = profile_list[0]
     self.category = Category.objects.all()[0]
     create_submissions(1, self.phase, self.alex)
     self.submission_a = Submission.objects.get()
     self.parent = self.submission_a.parent
     self.help_url = reverse('entry_help', args=[self.parent.slug])
     self.valid_data = {
         'notes': 'Help Wanted',
         'status': SubmissionHelp.PUBLISHED,
     }
Exemple #15
0
def judging_setup(create_criteria=True, submission_count=1):
    challenge_setup()
    if create_criteria:
        questions = ["How %s is this idea?" % adjective for adjective in ["awesome", "sane", "badass"]]
        for question in questions:
            criterion = JudgingCriterion.objects.create(question=question)
            PhaseCriterion.objects.create(phase=Phase.objects.get(), criterion=criterion)

    create_users()
    submission_type = ContentType.objects.get_for_model(Submission)
    judge_permission, _ = Permission.objects.get_or_create(codename="judge_submission", content_type=submission_type)
    alex = User.objects.get(username="******")
    alex.user_permissions.add(judge_permission)

    create_submissions(submission_count, creator=alex.get_profile())
Exemple #16
0
 def setUp(self):
     challenge_setup()
     create_users()
     
     alex_profile = User.objects.get(username='******').get_profile()
     create_submissions(1, creator=alex_profile)
     
     submission = Submission.objects.get()
     self.view_path = submission.get_absolute_url()
     self.edit_path = submission.get_edit_url()
     
     ExternalLink.objects.create(submission=submission, name='Foo',
                                 url='http://example.com/')
     ExternalLink.objects.create(submission=submission, name='Foo',
                                 url='http://example.net/')
     
     self.client.login(username='******', password='******')
Exemple #17
0
 def test_challenge_entries(self):
     """Test that challenge entries come through to the challenge view."""
     submission_titles = create_submissions(3)
     response = self.client.get(Challenge.objects.get().get_entries_url())
     assert_equal(response.status_code, 200)
     # Make sure the entries are present and in reverse creation order
     assert_equal([s.title for s in response.context['entries'].object_list],
                  list(reversed(submission_titles)))
Exemple #18
0
 def test_challenge_entries(self):
     """Test that challenge entries come through to the challenge view."""
     submission_titles = create_submissions(3)
     response = self.client.get(Challenge.objects.get().get_entries_url())
     assert_equal(response.status_code, 200)
     # Make sure the entries are present and in reverse creation order
     assert_equal(
         [s.title for s in response.context['entries'].object_list],
         list(reversed(submission_titles)))
Exemple #19
0
def judging_setup(create_criteria=True, submission_count=1):
    challenge_setup()
    if create_criteria:
        questions = ['How %s is this idea?' % adjective
                     for adjective in ['awesome', 'sane', 'badass']]
        for question in questions:
            criterion = JudgingCriterion.objects.create(question=question)
            PhaseCriterion.objects.create(phase=Phase.objects.get(),
                                          criterion=criterion)
    
    create_users()
    submission_type = ContentType.objects.get_for_model(Submission)
    judge_permission, _ = Permission.objects.get_or_create(
                                        codename='judge_submission',
                                        content_type=submission_type)
    alex = User.objects.get(username='******')
    alex.user_permissions.add(judge_permission)
    
    create_submissions(submission_count, creator=alex.get_profile())
Exemple #20
0
 def setUp(self):
     challenge_setup()
     phase = Phase.objects.get()
     phase.name = 'Ideation'
     phase.save()
     create_users()
     admin = User.objects.create_user('admin', '*****@*****.**',
                                      password='******')
     admin.is_superuser = True
     admin.save()
     # Fill in the profile name to stop nag redirects
     admin_profile = admin.get_profile()
     admin_profile.name = 'Admin Adminson'
     admin_profile.save()
     alex_profile = User.objects.get(username='******').get_profile()
     create_submissions(1, creator=alex_profile)
     entry = Submission.objects.get()
     self.view_path = entry.get_absolute_url()
     self.edit_path = entry.get_edit_url()
Exemple #21
0
 def setUp(self):
     challenge_setup()
     phase = Phase.objects.get()
     phase.name = 'Ideation'
     phase.save()
     create_users()
     admin = User.objects.create_user('admin',
                                      '*****@*****.**',
                                      password='******')
     admin.is_superuser = True
     admin.save()
     # Fill in the profile name to stop nag redirects
     admin_profile = admin.get_profile()
     admin_profile.name = 'Admin Adminson'
     admin_profile.save()
     alex_profile = User.objects.get(username='******').get_profile()
     create_submissions(1, creator=alex_profile)
     entry = Submission.objects.get()
     self.view_path = entry.get_absolute_url()
     self.edit_path = entry.get_edit_url()
Exemple #22
0
 def test_entries_view(self):
     """Test the dedicated entries view.
     
     This is currently a thin proxy onto the challenge view, hence this test
     being practically identical to the one above.
     
     """
     submission_titles = create_submissions(4)
     response = self.client.get(Challenge.objects.get().get_entries_url())
     assert_equal(response.status_code, 200)
     # Make sure the entries are present and in reverse creation order
     assert_equal([s.title for s in response.context['entries'].object_list],
                  list(reversed(submission_titles)))
Exemple #23
0
 def test_entries_view(self):
     """Test the dedicated entries view.
     
     This is currently a thin proxy onto the challenge view, hence this test
     being practically identical to the one above.
     
     """
     submission_titles = create_submissions(4)
     phase = Phase.objects.get()
     response = self.client.get(phase.get_absolute_url())
     assert_equal(response.status_code, 200)
     # Make sure the entries are present and in reverse creation order
     assert_equal(
         [s.title for s in response.context['entries'].object_list],
         list(reversed(submission_titles)))
Exemple #24
0
 def setUp(self):
     challenge_setup()
     create_submissions(3)
     self.phase = Phase.objects.get()
     cache.clear()
 def setUp(self):
     challenge_setup()
     create_submissions(3)
     self.phase = Phase.objects.get()
     cache.clear()
Exemple #26
0
 def setUp(self):
     challenge_setup()
     create_submissions(3)
     cache.clear()
 def test_splash_page_with_entries(self):
     create_submissions(30)
     response = self.client.get(reverse('challenge_show'))
     self.assertEqual(response.status_code, 200)
     self.assertEqual(len(response.context['entries']), 5)