Esempio n. 1
0
    def setUp(self):
        """Generate test user and activity. Set the competition settings to the
        current date for testing."""
        challenge_mgr.init()
        self.user = User.objects.create_user('user', '*****@*****.**')
        self.user.save()
        self.activity = test_utils.create_activity()
        self.event = test_utils.create_event()

        self.current_round = "Round 1"

        test_utils.set_competition_round()
Esempio n. 2
0
    def setUp(self):
        """Generate test user and activity. Set the competition settings to the
        current date for testing."""
        challenge_mgr.init()
        self.user = User.objects.create_user('user', '*****@*****.**')
        self.user.save()
        self.activity = test_utils.create_activity()
        self.event = test_utils.create_event()

        self.current_round = "Round 1"

        test_utils.set_competition_round()
Esempio n. 3
0
 def setUp(self):
     """Sets up the environment for running the tests."""
     self.user = test_utils.setup_user(username="******", password="******")
     from apps.managers.cache_mgr import cache_mgr
     cache_mgr.clear()
     self.client.login(username="******", password="******")
     test_utils.set_competition_round()
     self.activity = test_utils.create_activity(slug=None, unlock_condition=None)
     self.activity.save()
     self.commitment = test_utils.create_commitment(slug=None, unlock_condition=None)
     self.commitment.save()
     self.event = test_utils.create_event(slug=None, unlock_condition=None)
     self.event.save()
Esempio n. 4
0
 def setUp(self):
     """Sets up the environment for running the tests."""
     self.user = test_utils.setup_user(username="******",
                                       password="******")
     from apps.managers.cache_mgr import cache_mgr
     cache_mgr.clear()
     self.client.login(username="******", password="******")
     test_utils.set_competition_round()
     self.activity = test_utils.create_activity(slug=None,
                                                unlock_condition=None)
     self.activity.save()
     self.commitment = test_utils.create_commitment(slug=None,
                                                    unlock_condition=None)
     self.commitment.save()
     self.event = test_utils.create_event(slug=None, unlock_condition=None)
     self.event.save()
Esempio n. 5
0
 def testRejectedActivity(self):
     """
     Test that a rejected activity submission posts a message.
     """
     activity = test_utils.create_activity()
     member = ActionMember(
         action=activity,
         user=self.user,
         approval_status="rejected",
         submission_date=datetime.datetime.today(),
     )
     member.save()
     response = self.client.get(reverse("learn_index"))
     self.assertContains(response, 'Your response to <a href="%s' % (
         reverse("activity_task", args=(activity.type, activity.slug,)),
         ))
     response = self.client.get(reverse("learn_index"))
     self.assertNotContains(response, "notification-box")
Esempio n. 6
0
 def testRejectedActivity(self):
     """
     Test that a rejected activity submission posts a message.
     """
     activity = test_utils.create_activity()
     member = ActionMember(
         action=activity,
         user=self.user,
         approval_status="rejected",
         submission_date=datetime.datetime.today(),
     )
     member.save()
     response = self.client.get(reverse("learn_index"))
     self.assertContains(
         response, 'Your response to <a href="%s' %
         (reverse("activity_task", args=(
             activity.type,
             activity.slug,
         )), ))
     response = self.client.get(reverse("learn_index"))
     self.assertNotContains(response, "notification-box")