def METHOD_NAME(user_factory, tag_category_factory, context_factory):
    auth_user = user_factory(rank=model.User.RANK_REGULAR)
    category = tag_category_factory(name="name", color="black")
    db.session.add(category)
    db.session.flush()
    with patch("szurubooru.func.tag_categories.serialize_category"), patch(
        "szurubooru.func.tag_categories.update_category_name"
    ), patch("szurubooru.func.tag_categories.update_category_color"), patch(
        "szurubooru.func.snapshots.modify"
    ):
        tag_categories.update_category_name.side_effect = _update_category_name
        tag_categories.serialize_category.return_value = "serialized category"
        result = api.tag_category_api.update_tag_category(
            context_factory(
                params={"name": "changed", "color": "white", "version": 1},
                user=auth_user,
            ),
            {"category_name": "name"},
        )
        assert result == "serialized category"
        tag_categories.update_category_name.assert_called_once_with(
            category, "changed"
        )
        tag_categories.update_category_color.assert_called_once_with(
            category, "white"
        )
        snapshots.modify.assert_called_once_with(category, auth_user)