def setUp(self):
        """setup"""
        self.user = self.user = test_utils.setup_user(username="******", password="******")

        challenge_mgr.register_page_widget("learn", "smartgrid")

        self.client.login(username="******", password="******")
Exemple #2
0
    def setUp(self):
        self.user = test_utils.setup_user(username="******", password="******")

        challenge_mgr.register_page_widget("help", "help.rule")
        cache_mgr.clear()

        self.client.login(username="******", password="******")
    def setUp(self):
        """Set up a team and log in."""
#        challenge_mgr.init()
        test_utils.set_competition_round()
        self.user = test_utils.setup_user(username="******", password="******")

        test_utils.setup_round_prize("Round 1", "team_overall", "energy")
        test_utils.setup_round_prize("Round 2", "team_overall", "energy")
        test_utils.setup_round_prize("Round 1", "team_overall", "points")
        test_utils.setup_round_prize("Round 2", "team_overall", "points")
        test_utils.setup_round_prize("Round 1", "individual_overall", "points")
        test_utils.setup_round_prize("Round 2", "individual_overall", "points")
        test_utils.setup_round_prize("Round 1", "individual_team", "points")
        test_utils.setup_round_prize("Round 2", "individual_team", "points")

        print "setUp prize count %d" % Prize.objects.count()

        challenge_mgr.register_page_widget("win", "prizes")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        profile = self.user.get_profile()
        profile.add_points(10, datetime.datetime.today(), "test")
        profile.save()

        self.client.login(username="******", password="******")
Exemple #4
0
    def setUp(self):
        """Initialize a user and log them in."""
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.get_profile().team
        test_utils.set_competition_round()

        challenge_mgr.register_page_widget("energy", "resource_scoreboard.energy")
        self.client.login(username="******", password="******")
Exemple #5
0
    def setUp(self):
        """setup"""
        self.user = test_utils.setup_user(username="******", password="******")
        test_utils.set_competition_round()
        challenge_mgr.register_page_widget("profile", "my_info")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
Exemple #6
0
    def setUp(self):
        """setup"""
        self.user = test_utils.setup_user(username="******", password="******")
        test_utils.set_competition_round()
        challenge_mgr.register_page_widget("profile", "my_info")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
    def setUp(self):
        """setup"""
        self.user = self.user = test_utils.setup_user(username="******", password="******")

        challenge_mgr.register_page_widget("learn", "smartgrid")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
    def testIndex(self):
        """Check that we can load the index."""
        test_utils.set_competition_round()
        User.objects.create_user("user", "*****@*****.**", password="******")
        self.client.login(username="******", password="******")

        challenge_mgr.register_page_widget("home", "home")

        response = self.client.get(reverse("home_index"))
        self.failUnlessEqual(response.status_code, 200)
Exemple #9
0
    def testIndex(self):
        """Check that we can load the index."""
        test_utils.set_competition_round()
        User.objects.create_user("user", "*****@*****.**", password="******")
        self.client.login(username="******", password="******")

        challenge_mgr.register_page_widget("home", "home")

        response = self.client.get(reverse("home_index"))
        self.failUnlessEqual(response.status_code, 200)
Exemple #10
0
    def setUp(self):
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.get_profile().team

        challenge_mgr.register_page_widget("help", "help.faq")
        challenge_mgr.register_page_widget("home", "home")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
Exemple #11
0
    def setUp(self):
        """
        setup
        """
        challenge_mgr.init()

        self.user = test_utils.setup_user(username="******", password="******")
        test_utils.set_competition_round()
        challenge_mgr.register_page_widget("learn", "participation")
        cache_mgr.clear()
        self.client.login(username="******", password="******")
Exemple #12
0
    def setUp(self):
        """setup"""
        self.user = self.user = test_utils.setup_user(username="******",
                                                      password="******")

        challenge_mgr.register_page_widget("learn", "smartgrid")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
Exemple #13
0
    def setUp(self):
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.get_profile().team

        challenge_mgr.register_page_widget("help", "help.faq")
        challenge_mgr.register_page_widget("home", "home")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
    def setUp(self):
        """setup"""
        self.user = User.objects.create_user("user", "*****@*****.**", password="******")
        profile = self.user.get_profile()
        profile.setup_profile = True
        profile.setup_complete = True
        profile.save()

        challenge_mgr.register_page_widget("home", "quests")

        self.client.login(username="******", password="******")
Exemple #15
0
    def setUp(self):
        """Set up rounds, team, and a user."""
        # Set up rounds.

        test_utils.set_two_rounds()

        # Set up user
        self.user = test_utils.setup_user(username="******", password="******")

        challenge_mgr.register_page_widget("win", "raffle")
        self.client.login(username="******", password="******")
Exemple #16
0
    def setUp(self):
        """
        setup
        """
        challenge_mgr.init()

        self.user = test_utils.setup_user(username="******", password="******")
        test_utils.set_competition_round()
        challenge_mgr.register_page_widget("learn", "participation")
        cache_mgr.clear()
        self.client.login(username="******", password="******")
Exemple #17
0
    def setUp(self):
        """Set up rounds, team, and a user."""
        # Set up rounds.

        test_utils.set_three_rounds()

        # Set up user
        self.user = test_utils.setup_user(username="******", password="******")

        challenge_mgr.register_page_widget("win", "raffle")
        self.client.login(username="******", password="******")
Exemple #18
0
 def testLogin(self):
     """Test logging in the user to the system."""
     username = "******"
     password = "******"
     test_utils.setup_user(username, password)
     challenge_mgr.register_page_widget("home", "home")
     self.login(username, password)
     self.selenium.get('%s%s' % (self.live_server_url, "/home/"))
     try:
         self.assertEqual("Kukui Cup: Home", self.selenium.title)
     except AssertionError, e:
         print e
Exemple #19
0
 def testLogin(self):
     """Test logging in the user to the system."""
     username = "******"
     password = "******"
     test_utils.setup_user(username, password)
     challenge_mgr.register_page_widget("home", "home")
     self.login(username, password)
     self.selenium.get('%s%s' % (self.live_server_url, "/home/"))
     try:
         self.assertEqual("Kukui Cup: Home", self.selenium.title)
     except AssertionError, e:
         print e
Exemple #20
0
    def setUp(self):
        """Initialize a user and log them in."""
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.profile.team
        test_utils.set_competition_round()

        challenge_mgr.register_page_widget("energy", "resource_scoreboard.energy")
        game, _ = GameInfo.objects.get_or_create(name="Energy Game")
        game.enabled = True
        game.save()

        self.client.login(username="******", password="******")
    def setUp(self):
        """setup."""
        test_utils.set_competition_round()
        self.user = User.objects.create_user("user", "*****@*****.**", password="******")

        # create the term help-topic
        HelpTopic.objects.create(title="", slug="terms-and-conditions", category="faq", contents="")

        # create the setup activity
        Activity.objects.create(slug=SETUP_WIZARD_ACTIVITY, name="", title="", expected_duration=5)

        challenge_mgr.register_page_widget("home", "home")
        self.client.login(username="******", password="******")
Exemple #22
0
    def setUp(self):
        """Initialize a user and log them in."""
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.get_profile().team
        test_utils.set_competition_round()

        challenge_mgr.register_page_widget("energy",
                                           "resource_scoreboard.energy")
        game, _ = GameInfo.objects.get_or_create(name="Energy Game")
        game.enabled = True
        game.save()

        self.client.login(username="******", password="******")
Exemple #23
0
    def setUp(self):
        """setup."""
        test_utils.set_competition_round()
        self.user = User.objects.create_user("user", "*****@*****.**", password="******")

        # create the term help-topic
        HelpTopic.objects.create(title="", slug="terms-and-conditions", category="faq", contents="")

        # create the setup activity
        Activity.objects.create(slug=SETUP_WIZARD_ACTIVITY, name="", title="", duration=5)

        challenge_mgr.register_page_widget("home", "home")
        self.client.login(username="******", password="******")
    def setUp(self):
        """setup"""
        self.user = User.objects.create_user("user",
                                             "*****@*****.**",
                                             password="******")
        profile = self.user.profile
        profile.setup_profile = True
        profile.setup_complete = True
        profile.save()

        test_utils.enable_quest()
        challenge_mgr.register_page_widget("home", "home")

        self.client.login(username="******", password="******")
Exemple #25
0
    def testRoundInfo(self):
        """Tests that round info is available for the page to process."""
        challenge_mgr.init()
        test_utils.set_competition_round()
        current_round = challenge_mgr.get_round_name()

        User.objects.create_user("user", "*****@*****.**", password="******")
        self.client.login(username="******", password="******")

        challenge_mgr.register_page_widget("home", "home")
        response = self.client.get(reverse("home_index"))
        # Response context should have round info corresponding to the past days.

        self.assertEqual(response.context["CURRENT_ROUND_INFO"]["name"], current_round,
            "Expected %s but got %s" % (
                current_round, response.context["CURRENT_ROUND_INFO"]["name"]))
Exemple #26
0
    def testRoundInfo(self):
        """Tests that round info is available for the page to process."""
        challenge_mgr.init()
        test_utils.set_competition_round()
        current_round = challenge_mgr.get_round_name()

        User.objects.create_user("user", "*****@*****.**", password="******")
        self.client.login(username="******", password="******")

        challenge_mgr.register_page_widget("home", "home")
        response = self.client.get(reverse("home_index"))
        # Response context should have round info corresponding to the past days.

        self.assertEqual(
            response.context["CURRENT_ROUND_INFO"]["name"], current_round,
            "Expected %s but got %s" %
            (current_round, response.context["CURRENT_ROUND_INFO"]["name"]))
Exemple #27
0
    def setUp(self):
        """Sets up the test evironment for the Designer views."""
        self.user = test_utils.setup_superuser(username="******", password="******")

        challenge_mgr.register_page_widget("sgg_designer", "smartgrid_design")
        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
        try:
            draft = smartgrid_mgr.get_designer_draft(self.draft_slug)
        except Http404:  # shouldn't happen Default draft is defined in base_settings
            draft = Draft(name='Default', slug='default')
            draft.save()
        try:
            level = smartgrid_mgr.get_designer_level(draft, self.level_slug)
        except Http404:  # ensure there is a DesignerLevel
            level = DesignerLevel(name="Level 1", slug=self.level_slug, priority=1, draft=draft)
            level.save()
Exemple #28
0
    def setUp(self):
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.get_profile().team

        challenge_mgr.register_page_widget("news", "popular_tasks")
        challenge_mgr.register_page_widget("news", "my_commitments")
        challenge_mgr.register_page_widget("news", "wallpost.system_wallpost")
        challenge_mgr.register_page_widget("news", "wallpost.user_wallpost")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
Exemple #29
0
    def setUp(self):
        self.user = test_utils.setup_user(username="******", password="******")
        self.team = self.user.profile.team

        challenge_mgr.register_page_widget("news", "popular_tasks")
        challenge_mgr.register_page_widget("news", "my_commitments")
        challenge_mgr.register_page_widget("news", "wallpost.system_wallpost")
        challenge_mgr.register_page_widget("news", "wallpost.user_wallpost")

        from apps.managers.cache_mgr import cache_mgr
        cache_mgr.clear()

        self.client.login(username="******", password="******")
Exemple #30
0
    def testPages(self):
        """Test accessing all the pages in the system."""
        username = "******"
        password = "******"
        test_utils.setup_user(username, password)

        challenge_mgr.register_page_widget("home", "home")
        challenge_mgr.register_page_widget("learn", "home")
        challenge_mgr.register_page_widget("energy", "home")
        challenge_mgr.register_page_widget("water", "home")
        challenge_mgr.register_page_widget("news", "home")
        challenge_mgr.register_page_widget("profile", "home")
        challenge_mgr.register_page_widget("help", "home")
        challenge_mgr.register_page_widget("win", "win")
        challenge_mgr.register_page_widget("status", "status")
        challenge_mgr.register_page_widget("about", "about")

        self.login(username, password)

        try:
            self.selenium.get('%s%s' % (self.live_server_url, "/home/"))
            self.assertEqual("Kukui Cup: Home", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/learn/"))
            self.assertEqual("Kukui Cup: Learn", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/energy/"))
            self.assertEqual("Kukui Cup: Energy", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/water/"))
            self.assertEqual("Kukui Cup: Water", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/news/"))
            self.assertEqual("Kukui Cup: News", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/win/"))
            self.assertEqual("Kukui Cup: Win", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/profile/"))
            self.assertEqual("Kukui Cup: Profile", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/help/"))
            self.assertEqual("Kukui Cup: Help", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/status/"))
            self.assertEqual("Kukui Cup: Status", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/about/"))
            self.assertEqual("Kukui Cup: Welcome to KukuiCup!",
                             self.selenium.title)
        except AssertionError, e:
            print e
Exemple #31
0
    def testPages(self):
        """Test accessing all the pages in the system."""
        username = "******"
        password = "******"
        test_utils.setup_user(username, password)

        challenge_mgr.register_page_widget("home", "home")
        challenge_mgr.register_page_widget("learn", "home")
        challenge_mgr.register_page_widget("energy", "home")
        challenge_mgr.register_page_widget("water", "home")
        challenge_mgr.register_page_widget("news", "home")
        challenge_mgr.register_page_widget("profile", "home")
        challenge_mgr.register_page_widget("help", "home")
        challenge_mgr.register_page_widget("win", "win")
        challenge_mgr.register_page_widget("status", "status")
        challenge_mgr.register_page_widget("about", "about")

        self.login(username, password)

        try:
            self.selenium.get('%s%s' % (self.live_server_url, "/home/"))
            self.assertEqual("Kukui Cup: Home", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/learn/"))
            self.assertEqual("Kukui Cup: Learn", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/energy/"))
            self.assertEqual("Kukui Cup: Energy", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/water/"))
            self.assertEqual("Kukui Cup: Water", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/news/"))
            self.assertEqual("Kukui Cup: News", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/win/"))
            self.assertEqual("Kukui Cup: Win", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/profile/"))
            self.assertEqual("Kukui Cup: Profile", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/help/"))
            self.assertEqual("Kukui Cup: Help", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/status/"))
            self.assertEqual("Kukui Cup: Status", self.selenium.title)
            self.selenium.get('%s%s' % (self.live_server_url, "/about/"))
            self.assertEqual("Kukui Cup: Welcome to KukuiCup!", self.selenium.title)
        except AssertionError, e:
            print e