Skip to content

Commit ed53434

Browse files
Extended update category unit-test
1 parent 06b6b02 commit ed53434

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/platform/test_service_categories.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,40 @@ def test_category_update(old_client):
7777
It doesn't test the actual update itself.
7878
TODO: See if this is worth testing since we're using a mocking backend
7979
"""
80+
parent_category = old_client.categories.create(
81+
models.CategoryDraft(
82+
key="parent-test-category",
83+
slug=models.LocalizedString(nl="nl-slug-parent"),
84+
name=models.LocalizedString(nl="parent-category"),
85+
)
86+
)
87+
8088
category = old_client.categories.create(
8189
models.CategoryDraft(
8290
key="test-category",
8391
slug=models.LocalizedString(nl="nl-slug"),
8492
name=models.LocalizedString(nl="category"),
93+
parent=models.CategoryResourceIdentifier(id=parent_category.id),
94+
order_hint="0.00001",
95+
description=models.LocalizedString(nl="description-nl"),
8596
)
8697
)
8798
assert category.key == "test-category"
99+
assert category.order_hint == "0.00001"
100+
assert getattr(category.parent, "id") == parent_category.id
88101

89102
category = old_client.categories.update_by_id(
90103
id=category.id,
91104
version=category.version,
92105
actions=[
93-
models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2"))
106+
models.CategoryChangeSlugAction(slug=models.LocalizedString(nl="nl-slug2")),
107+
models.CategorySetDescriptionAction(
108+
description=models.LocalizedString(nl="updated-description-nl")
109+
),
94110
],
95111
)
96112
assert category.key == "test-category"
113+
assert category.description == models.LocalizedString(nl="updated-description-nl")
97114

98115
category = old_client.categories.update_by_key(
99116
key="test-category",

0 commit comments

Comments
 (0)