Skip to content

Commit 7a53c69

Browse files
authored
Merge pull request #2194 from python-gitlab/jlvillal/update-gitlab
test(functional): bump GitLab docker image to 15.2.0-ee.0
2 parents 8ba97aa + b46b379 commit 7a53c69

File tree

9 files changed

+47
-54
lines changed

9 files changed

+47
-54
lines changed

docs/api-objects.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ API examples
1111
gl_objects/emojis
1212
gl_objects/badges
1313
gl_objects/branches
14-
gl_objects/clusters
1514
gl_objects/messages
1615
gl_objects/ci_lint
1716
gl_objects/commits
@@ -63,3 +62,4 @@ API examples
6362
gl_objects/variables
6463
gl_objects/sidekiq
6564
gl_objects/wikis
65+
gl_objects/clusters

docs/gl_objects/clusters.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
############
2-
Clusters
3-
############
1+
#####################
2+
Clusters (DEPRECATED)
3+
#####################
4+
5+
.. warning::
6+
Cluster support was deprecated in GitLab 14.5 and disabled by default as of
7+
GitLab 15.0
8+
49

510
Reference
611
---------

docs/gl_objects/topics.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Get a specific topic by its ID::
3030

3131
Create a new topic::
3232

33-
topic = gl.topics.create({"name": "my-topic"})
33+
topic = gl.topics.create({"name": "my-topic", "title": "my title"})
3434

3535
Update a topic::
3636

gitlab/v4/objects/topics.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ class TopicManager(CRUDMixin, RESTManager):
1919
_path = "/topics"
2020
_obj_cls = Topic
2121
_create_attrs = RequiredOptional(
22-
required=("name",), optional=("avatar", "description")
22+
# NOTE: The `title` field was added and is required in GitLab 15.0 or
23+
# newer. But not present before that.
24+
required=("name",),
25+
optional=("avatar", "description", "title"),
2326
)
2427
_update_attrs = RequiredOptional(optional=("avatar", "description", "name"))
2528
_types = {"avatar": types.ImageAttribute}

tests/functional/api/test_clusters.py

-44
This file was deleted.

tests/functional/api/test_topics.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
"""
55

66

7-
def test_topics(gl):
7+
def test_topics(gl, gitlab_version):
88
assert not gl.topics.list()
99

10-
topic = gl.topics.create({"name": "my-topic", "description": "My Topic"})
10+
create_dict = {"name": "my-topic", "description": "My Topic"}
11+
if gitlab_version.major >= 15:
12+
create_dict["title"] = "my topic title"
13+
topic = gl.topics.create(
14+
{"name": "my-topic", "title": "my topic title", "description": "My Topic"}
15+
)
1116
assert topic.name == "my-topic"
17+
if gitlab_version.major >= 15:
18+
assert topic.title == "my topic title"
1219
assert gl.topics.list()
1320

1421
topic.description = "My Updated Topic"

tests/functional/conftest.py

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import dataclasses
12
import logging
23
import tempfile
34
import time
@@ -12,6 +13,24 @@
1213
from tests.functional import helpers
1314

1415

16+
@dataclasses.dataclass
17+
class GitlabVersion:
18+
major: int
19+
minor: int
20+
patch: str
21+
revision: str
22+
23+
def __post_init__(self):
24+
self.major, self.minor = int(self.major), int(self.minor)
25+
26+
27+
@pytest.fixture(scope="session")
28+
def gitlab_version(gl) -> GitlabVersion:
29+
version, revision = gl.version()
30+
major, minor, patch = version.split(".")
31+
return GitlabVersion(major=major, minor=minor, patch=patch, revision=revision)
32+
33+
1534
@pytest.fixture(scope="session")
1635
def fixture_dir(test_dir):
1736
return test_dir / "functional" / "fixtures"

tests/functional/fixtures/.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
GITLAB_IMAGE=gitlab/gitlab-ee
2-
GITLAB_TAG=14.9.2-ee.0
2+
GITLAB_TAG=15.2.0-ee.0

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)