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