summaryrefslogtreecommitdiff
path: root/test/varlink/podman_testcase.py
blob: c8395a5f118f01bbaa31209139ced417ddcdd5e6 (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
"""Custom TestCase for varlink/podman."""
import os
import unittest

import varlink


class PodmanTestCase(unittest.TestCase):
    """Provides varlink setup for podman."""

    def __init__(self, *args, **kwargs):
        """Initialize class by calling parent."""
        super(PodmanTestCase, self).__init__(*args, **kwargs)
        self.address = os.environ.get(
            'PODMAN_HOST',
            'unix:/run/podman/io.projectatomic.podman')

    def setUp(self):
        """Set up the varlink/podman fixture before each test."""
        super(PodmanTestCase, self).setUp()
        self.client = varlink.Client(
            address=self.address)
        self.podman = self.client.open('io.projectatomic.podman')

    def tearDown(self):
        """Deconstruct the varlink/podman fixture after each test."""
        super(PodmanTestCase, self).tearDown()
        self.podman.close()