summaryrefslogtreecommitdiff
path: root/tests/functional/api/test_clusters.py
blob: 8930aad84b382c1cf3aafdc1f4204928d3ed51cc (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
def test_project_clusters(project):
    project.clusters.create(
        {
            "name": "cluster1",
            "platform_kubernetes_attributes": {
                "api_url": "http://url",
                "token": "tokenval",
            },
        }
    )
    clusters = project.clusters.list()
    assert len(clusters) == 1

    cluster = clusters[0]
    cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
    cluster.save()

    cluster = project.clusters.list()[0]
    assert cluster.platform_kubernetes["api_url"] == "http://newurl"

    cluster.delete()
    assert len(project.clusters.list()) == 0


def test_group_clusters(group):
    group.clusters.create(
        {
            "name": "cluster1",
            "platform_kubernetes_attributes": {
                "api_url": "http://url",
                "token": "tokenval",
            },
        }
    )
    clusters = group.clusters.list()
    assert len(clusters) == 1

    cluster = clusters[0]
    cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
    cluster.save()

    cluster = group.clusters.list()[0]
    assert cluster.platform_kubernetes["api_url"] == "http://newurl"

    cluster.delete()
    assert len(group.clusters.list()) == 0