I've been testing my application and got stuck into error that does not seem to have anything to do with the application itself. I have a unit test like this:

class TagSaveAndLoadTest(TestCase):
    fixtures = ['users.json']

    def setUp(self):
        self.client = Client()
        self.client.login(user='test_user', password='123')

    def test_register_save(self):  
        tag_dict = {
                        'sex' : 4,
                        'drugs' : 3,
                        'rocknroll' : 1,
                    }
        response = self.client.post('/register/save_tags/', {'skilltags' : json.dumps(tag_dict)})
        self.assertEqual(response.status_code, 200)

The error I get is: TypeError: int() argument must be a string or a number, not 'AnonymousUser'. Files appearing in the traceback are base.py, manages.py, query.py, etc. It seems like my request gets stuck somewhere in the middleware, and I have no idea how to deal with it. How is it even possible for the request not to reach my view or even controller? Why there is a problem with AnonymousUser if the 'setUp()' function logs a test user in?

Full traceback can be found here, thanks in advance!

Edit
Report