Skip to content

Django 5.2 support #215

@systemallica

Description

@systemallica

Using test_plus APITestCase with django 5.2 raises the following error if I try to use self.client.force_authenticate:
AttributeError: 'Client' object has no attribute 'force_authenticate'

This seems to be because the new django 5.2 version seems to have changed how the client_class is read, see here.

As I understand, APITestCase should go from this:

class APITestCase(TestCase):
    def __init__(self, *args, **kwargs):
        self.client_class = get_api_client()
        super(APITestCase, self).__init__(*args, **kwargs)

To this:

class APITestCase(TestCase):
    client_class = get_api_client()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions