Skip to content

Use TestCase.assertDictEqual when comparing DRF serializer errors #16198

Description

@freshstrangemusic

If we call self.assertEqual(dict(), serializer.errors), TestCase.assertEqual will not dispatch to assertDictEqual because type(serializer.errors) is not dict and it falls back to the generic equality assertion function. This is what produces unusable error messages that are highly truncated.

An alternative would be to subclass django.TestCase and override _getAssertEqualityFunc to special case the dict wrapper returned by DRF.

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    MaintenanceTaskhttps://mozilla.github.io/task-defect-enhancement/index.html

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions