Skip to content

Commit ffdef9b

Browse files
chore(topics): 'title' is required when creating a topic
1 parent 69014e9 commit ffdef9b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

gitlab/v4/objects/topics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TopicManager(CRUDMixin, RESTManager):
1919
_path = "/topics"
2020
_obj_cls = Topic
2121
_create_attrs = RequiredOptional(
22-
required=("name",), optional=("avatar", "description")
22+
required=("name", "title"), optional=("avatar", "description")
2323
)
2424
_update_attrs = RequiredOptional(optional=("avatar", "description", "name"))
2525
_types = {"avatar": types.ImageAttribute}

tests/functional/api/test_topics.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
def test_topics(gl):
88
assert not gl.topics.list()
99

10-
topic = gl.topics.create({"name": "my-topic", "description": "My Topic"})
10+
topic = gl.topics.create(
11+
{"name": "my-topic", "title": "my topic title", "description": "My Topic"}
12+
)
1113
assert topic.name == "my-topic"
14+
assert topic.title == "my topic title"
1215
assert gl.topics.list()
1316

1417
topic.description = "My Updated Topic"

tests/unit/objects/test_topics.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
from gitlab.v4.objects import Topic
99

1010
name = "GitLab"
11+
topic_title = "topic title"
1112
new_name = "gitlab-test"
1213
topic_content = {
1314
"id": 1,
1415
"name": name,
16+
"title": topic_title,
1517
"description": "GitLab is an open source end-to-end software development platform.",
1618
"total_projects_count": 1000,
1719
"avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
@@ -102,9 +104,10 @@ def test_get_topic(gl, resp_get_topic):
102104

103105

104106
def test_create_topic(gl, resp_create_topic):
105-
topic = gl.topics.create({"name": name})
107+
topic = gl.topics.create({"name": name, "title": topic_title})
106108
assert isinstance(topic, Topic)
107109
assert topic.name == name
110+
assert topic.title == topic_title
108111

109112

110113
def test_update_topic(gl, resp_update_topic):

0 commit comments

Comments
 (0)