def METHOD_NAME(
    form_mock,
    client,
    admin,
    project_a,
    tag_a,
):
    form_mock.configure_mock(
        **{
            "return_value.return_value.is_valid.return_value": False,
            "return_value.return_value.errors": ["BIG PROBLEM"],
        }
    )
    client.force_login(admin)
    url = reverse(
        "pontoon.admin.project.ajax.tag",
        kwargs=dict(
            project=project_a.slug,
            tag=tag_a.slug,
        ),
    )
    response = client.post(
        url,
        HTTP_X_REQUESTED_WITH="XMLHttpRequest",
    )
    assert response.status_code == 400
    assert form_mock.return_value.call_args[1]["project"] == project_a
    assert dict(form_mock.return_value.call_args[1]["data"]) == dict(tag=["tag"])
    assert form_mock.return_value.return_value.is_valid.called
    assert not form_mock.return_value.return_value.save.called
    assert response.json() == {"errors": ["BIG PROBLEM"]}
    form_mock.return_value.reset_mock()
    response = client.post(
        url,
        data=dict(foo="bar", bar="baz"),
        HTTP_X_REQUESTED_WITH="XMLHttpRequest",
    )
    assert response.status_code == 400
    assert form_mock.return_value.call_args[1]["project"] == project_a
    assert dict(form_mock.return_value.call_args[1]["data"]) == dict(
        foo=["bar"],
        bar=["baz"],
        tag=["tag"],
    )
    assert form_mock.return_value.return_value.is_valid.called
    assert not form_mock.return_value.return_value.save.called
    assert response.json() == {"errors": ["BIG PROBLEM"]}