summaryrefslogtreecommitdiff
path: root/test/varlink/test_containers.py
blob: 651461d5514642c50bb8c8b85e2ce2e8642da100 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import unittest
from varlink import (Client, VarlinkError)


address = "unix:/run/podman/io.projectatomic.podman"
client = Client(address=address)


def runErrorTest(tfunc):
    try:
        tfunc()
    except VarlinkError as e:
        return e.error() == "org.varlink.service.MethodNotImplemented"
    return False


class ContainersAPI(unittest.TestCase):
    def test_ListContainers(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ListContainers))

    def test_CreateContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.CreateContainer))

    def test_InspecContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.InspectContainer))

    def test_ListContainerProcesses(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ListContainerProcesses))

    def test_GetContainerLogs(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.GetContainerLogs))

    def test_ListContainerChanges(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ListContainerChanges))

    def test_ExportContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ExportContainer))

    def test_GetContainerStats(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.GetContainerStats))

    def test_ResizeContainerTty(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ResizeContainerTty))

    def test_StartContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.StartContainer))

    def test_RestartContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.RestartContainer))

    def test_KillContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.KillContainer))

    def test_UpdateContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.UpdateContainer))

    def test_RenameContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.RenameContainer))

    def test_PauseContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.PauseContainer))

    def test_UnpauseContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.UnpauseContainer))

    def test_AttachToContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.AttachToContainer))

    def test_WaitContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.WaitContainer))

    def test_RemoveContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.RemoveContainer))

    def test_DeleteContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.DeleteContainer))

if __name__ == '__main__':
    unittest.main()