Пример #1
0
    def setUp(self):
        create_users(self)
        create_games(self)

        # create a TreasureHunt game
        self.hunt = TreasureHuntGame()
        self.hunt.created_by = User.objects.get(pk=1)
        self.hunt.save()
Пример #2
0
    def setUp(self):
        create_users(self)
        create_games(self)

        # most tests will need a response from a logged-in user,
        # who is the creator of the game
        self.game = Game.objects.get(pk=1)
        self.user = User.objects.get(pk=1)
        self.assertEqual(self.user, self.game.created_by)
        self.url = reverse(self.view, args=(self.game.pk,))
        self.assertTrue(self.client.login(username=self.user.username, password=self.user.username))
        self.response = self.client.get(self.url)
Пример #3
0
    def setUp(self):
        create_users(self)
        create_games(self)
        create_players(self)

        # most tests will need a response from a logged-in user,
        # who is a player of the game, who gave a code for a location
        # from the game
        self.game = TreasureHuntGame.objects.all()[0]
        self.player = self.game.player_set.all()[0]
        self.user = self.player.user
        self.location = self.game.location_set.all()[0]
        self.url = reverse(self.view, args=(self.location.uuid,))
        self.assertTrue(self.client.login(username=self.user.username, password=self.user.username))
        self.response = self.client.get(self.url)
Пример #4
0
    def setUp(self):
        create_users(self)

        # most tests will need a response from a logged-in user
        self.user = User.objects.get(pk=1)
        self.assertTrue(self.client.login(username=self.user.username, password=self.user.username))
        self.response = self.client.get(self.url)

        # POST data to create a game, since multiple tests need this
        self.point_data = [{"id": "0", "lat": "12.34533", "lon": "-0.32112"}]
        self.form_data = {
            "game_type": GAME_TYPES[0][0],
            "is_public": True,
            "city": "calgary",
            "locations": simplejson.dumps(self.point_data),
        }
Пример #5
0
    def setUp(self):
        create_users(self)
        create_games(self)

        self.response = self.client.get(self.url)