blob: 36b8263bb501bd8b3c5cc106106e3bbcb3df94b5 (
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
|
""" Tests for the openshift_version Ansible filter module. """
# pylint: disable=missing-docstring,invalid-name
import os
import sys
import unittest
sys.path = [os.path.abspath(os.path.dirname(__file__) + "/../filter_plugins/")] + sys.path
# pylint: disable=import-error
import openshift_version # noqa: E402
class OpenShiftVersionTests(unittest.TestCase):
openshift_version_filters = openshift_version.FilterModule()
def test_gte_filters(self):
for major, minor_start, minor_end in self.openshift_version_filters.versions:
for minor in range(minor_start, minor_end):
# Test positive case
self.assertTrue(
self.openshift_version_filters._filters["oo_version_gte_{}_{}".format(major, minor)](
"{}.{}".format(major, minor + 1)))
# Test negative case
self.assertFalse(
self.openshift_version_filters._filters["oo_version_gte_{}_{}".format(major, minor)](
"{}.{}".format(major, minor)))
def test_get_filters(self):
self.assertTrue(
self.openshift_version_filters.filters() == self.openshift_version_filters._filters)
|