}
        # CALL
        resp = self.api_patch(oid = 2, data = data, authenticated = True)
        # ASSERT
#         print resp.content
        self.assertHttpAccepted(resp)
        self.assertValidJSON(resp.content)

    def test_update_nickname_fail(self):
        # SETUP
        data = {
            'nickname': 'harp'
        }
        # CALL
        resp = self.api_patch(oid = 2, data = data, authenticated = True)
        # ASSERT
#         print resp.content
        self.assertHttpBadRequest(resp)
        self.assertValidJSON(resp.content)


if __name__ == "__main__":
    test_methods = []
    test_methods = ['test_update_nickname_fail']
    module_name = 'battle.api.tests.player_resource_tests'
    HarpTestCase.run_tests(
            module_name,
            'TestPlayerResource', test_methods,
            verbose = False, fail_fast = True
        )
Ejemplo n.º 2
0
        self.assertEqual([BattleForm.WINNER_NOT_A_PLAYER], form._errors['winner'])

    #===========================================================================
    # save
    #===========================================================================
    def test_save(self):
        # SETUP
        expected_id = 5
        data = {
            'attacker': 1,
            'defender': 2,
            'winner': 1,
            'start': timezone.now(),
            'end': timezone.now()
        }
        # CALL
        actual = BattleForm(data = data).save()
        # ASSERT
        self.assertEqual(expected_id, actual.id)


if __name__ == "__main__":
    test_methods = []
#     test_methods = ['test_is_valid']
    module_name = 'battle.tests.battle_form_tests'
    HarpTestCase.run_tests(
            module_name,
            'TestBattleForm', test_methods,
            verbose = False, fail_fast = True
        )