summaryrefslogtreecommitdiff
path: root/tests/functional/api/test_topics.py
blob: 0d6a3ef32748bbab12967f9ada73297de0e17d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
GitLab API:
https://docs.gitlab.com/ce/api/topics.html
"""


def test_topics(gl, gitlab_version):
    assert not gl.topics.list()

    create_dict = {"name": "my-topic", "description": "My Topic"}
    if gitlab_version.major >= 15:
        create_dict["title"] = "my topic title"
    topic = gl.topics.create(
        {"name": "my-topic", "title": "my topic title", "description": "My Topic"}
    )
    assert topic.name == "my-topic"
    if gitlab_version.major >= 15:
        assert topic.title == "my topic title"
    assert gl.topics.list()

    topic.description = "My Updated Topic"
    topic.save()

    updated_topic = gl.topics.get(topic.id)
    assert updated_topic.description == topic.description

    topic.delete()
    assert not gl.topics.list()