summaryrefslogtreecommitdiff
path: root/test/varlink/test_images.py
blob: ef1ab1088a114b92d7c1212e97e0bf014a08fe53 (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
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 ImagesAPI(unittest.TestCase):
    def test_ListImages(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ListImages))

    def test_BuildImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.BuildImage))

    def test_CreateImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.CreateImage))

    def test_InspectImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.InspectImage))

    def test_HistoryImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.HistoryImage))

    def test_PushImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.PushImage))

    def test_TagImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.TagImage))

    def test_RemoveImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.TagImage))

    def test_SearchImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.SearchImage))

    def test_DeleteUnusedImages(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.DeleteUnusedImages))

    def test_CreateFromContainer(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.CreateFromContainer))

    def test_ImportImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ImportImage))

    def test_ExportImage(self):
        podman = client.open("io.projectatomic.podman")
        self.assertTrue(runErrorTest(podman.ExportImage))

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