diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-04-24 18:42:59 -0700 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-27 14:11:13 +0000 |
commit | 32db403b5e4fdb96e727e8cda3922d235ad63aa4 (patch) | |
tree | e8a397d1c221a4c9cc1a66ffa9b7742c4474b5cb /test/varlink/podman_testcase.py | |
parent | 37619de39abea9f6802b0f42e2be7dd142c516ed (diff) | |
download | podman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.tar.gz podman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.tar.bz2 podman-32db403b5e4fdb96e727e8cda3922d235ad63aa4.zip |
Refactor unittest for varlink component
- Allow unittest's to run as normal user
- Refactor tests to use unittest features
- Refactor tests to use fixtures to track resources
- Update test runner script to clean up on failure
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Closes: #683
Approved by: rhatdan
Diffstat (limited to 'test/varlink/podman_testcase.py')
-rw-r--r-- | test/varlink/podman_testcase.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/varlink/podman_testcase.py b/test/varlink/podman_testcase.py new file mode 100644 index 000000000..c8395a5f1 --- /dev/null +++ b/test/varlink/podman_testcase.py @@ -0,0 +1,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() |