Beispiel #1
0
    def test_a(self):
        """Version - equal versions are not greater than"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2.3', name='bar')

        self.assertFalse(v1 > v2)
        self.assertFalse(v2 > v1)
Beispiel #2
0
    def test_b(self):
        """Version - versions that are of different lengths are not equal, regardless of name"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2', name='bar')

        self.assertTrue(v1 != v2)
        self.assertTrue(v2 != v1)
Beispiel #3
0
    def test_c(self):
        """Version - the same versions are not not-equal, regardless of name"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2.3', name='bar')

        self.assertFalse(v1 != v2)
        self.assertFalse(v2 != v1)
Beispiel #4
0
    def test_b(self):
        """Version - versions that are longer are not equal, regardless of name"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2', name='bar')

        self.assertFalse(v1 == v2)
        self.assertFalse(v2 == v1)
Beispiel #5
0
    def test_a(self):
        """Version - different versions are not equal, regardless of name"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='2.2.3', name='bar')

        self.assertTrue(v1 != v2)
        self.assertTrue(v2 != v1)
Beispiel #6
0
    def test_b(self):
        """Version - Less specific versions that are otherwise identical are less than"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2', name='bar')

        self.assertFalse(v1 < v2)
        self.assertTrue(v2 < v1)
Beispiel #7
0
    def test_a(self):
        """Version - identical versions values are equal, regardless of name"""
        v1 = versions.Version(version='1.2.3', name='foo')
        v2 = versions.Version(version='1.2.3', name='bar')

        self.assertTrue(v1 == v2)
        self.assertTrue(v2 == v1)
Beispiel #8
0
    def test_d(self):
        """Version - Larger versions are greater than"""
        v1 = versions.Version(version='1.2.1', name='foo')
        v2 = versions.Version(version='1.2.2', name='bar')

        self.assertFalse(v1 > v2)
        self.assertTrue(v2 > v1)
Beispiel #9
0
    def test_c(self):
        """Version - zero is greater than ``None``"""
        v1 = versions.Version(version='1.2.0', name='foo')
        v2 = versions.Version(version='1.2', name='bar')

        self.assertTrue(v1 > v2)
        self.assertFalse(v2 > v1)
Beispiel #10
0
    def test_a(self):
        """Version - Larger version are not less than or equal to"""
        v1 = versions.Version(version='1.2.1', name='foo')
        v2 = versions.Version(version='1.2.2', name='bar')

        self.assertFalse(v1 >= v2)
        self.assertTrue(v2 >= v1)
Beispiel #11
0
    def test_b(self):
        """Version - Equal versions are less than or equal to"""
        v1 = versions.Version(version='1.2.1', name='foo')
        v2 = versions.Version(version='1.2.1', name='bar')

        self.assertTrue(v1 >= v2)
        self.assertTrue(v2 >= v1)
Beispiel #12
0
    def test_c(self):
        """Version - Less specific versions are less than or equal"""
        v1 = versions.Version(version='1.2', name='foo')
        v2 = versions.Version(version='1.2.1', name='bar')

        self.assertFalse(v1 >= v2)
        self.assertTrue(v2 >= v1)
Beispiel #13
0
    def test_c(self):
        """Version - ``None`` is less than zero"""
        v1 = versions.Version(version='1.2.0', name='foo')
        v2 = versions.Version(version='1.2', name='bar')

        self.assertFalse(v1 < v2)
        self.assertTrue(v2 < v1)
Beispiel #14
0
    def test_d(self):
        """Version - Larger versions are not less than"""
        v1 = versions.Version(version='1.2.1', name='foo')
        v2 = versions.Version(version='1.2.2', name='bar')

        self.assertTrue(v1 < v2)
        self.assertFalse(v2 < v1)
Beispiel #15
0
def version_ok(version_info, log):
    """Ensure the patch applies to the installed version of InsightIQ

    :Returns: Boolean

    :param version_info: **Required** Contains the minimum and maximum versions
                         of InsightIQ that the patch applies to.
    :type version_info: Dictionary

    :param log: **Required** The logging object
    :type log: logging.Logger
    """
    iiq_version = versions.get_iiq_version()
    min_version = versions.Version(name='patch-min', version=version_info['minimum'])
    max_version = versions.Version(name='patch-max', version=version_info['maximum'])
    log.info('Installed IIQ version: %s', iiq_version.version)
    log.info('Patch min version: %s', min_version.version)
    log.info('Patch max version: %s', max_version.version)
    return min_version <= iiq_version <= max_version
Beispiel #16
0
    def test_patch_property_ro(self):
        """Version.patch is read only"""
        v1 = versions.Version(version='1.2.3', name='foo')
        try:
            v1.patch = 234
        except AttributeError:
            passed = True
        else:
            passed = False

        self.assertTrue(passed)
Beispiel #17
0
    def test_build_property_ro(self):
        """Version.build is read only"""
        v1 = versions.Version(version='1.2.3', name='foo')
        try:
            v1.build = 9001
        except AttributeError:
            passed = True
        else:
            passed = False

        self.assertTrue(passed)
Beispiel #18
0
    def test_minor_property_ro(self):
        """Version.minor is read only"""
        v1 = versions.Version(version='1.2.3', name='foo')
        try:
            v1.minor = 33
        except AttributeError:
            passed = True
        else:
            passed = False

        self.assertTrue(passed)
Beispiel #19
0
    def test_d(self):
        """Version - Greather than or equal to operator supports strings"""
        v1 = versions.Version(version='1.2', name='foo')

        self.assertTrue(v1 >= '1.0')
Beispiel #20
0
    def test_build_property(self):
        """Version.build is read only"""
        v1 = versions.Version(version='1.2.3.4', name='foo')
        expected = 4

        self.assertEqual(v1.build, expected)
Beispiel #21
0
    def test_patch_property(self):
        """Version.patch is read only"""
        v1 = versions.Version(version='1.2.3', name='foo')
        expected = 3

        self.assertEqual(v1.patch, expected)
Beispiel #22
0
    def test_d(self):
        """Version - The less than or equal to operator works with strings"""
        v1 = versions.Version(version='1.2', name='foo')

        self.assertTrue(v1 <= '1.2')
Beispiel #23
0
    def test_undefined_semver(self):
        """Version - properties that are undefined are ``None``"""
        v1 = versions.Version(version='1.2.3', name='foo')
        expected = None

        self.assertEqual(v1.build, expected)
Beispiel #24
0
    def test_hash(self):
        """Version objects are hashable, i.e. can be added to a dictionary"""
        v1 = versions.Version(version='1.2.3', name='foo')
        my_dict = {v1: 'foo'}

        self.assertTrue(isinstance(my_dict, dict))
Beispiel #25
0
    def test_e(self):
        """Version - The greater than operator works with strings"""
        v1 = versions.Version(version='3.2.1', name='foo')

        self.assertTrue(v1 > '2.3')
Beispiel #26
0
 def test_get_other_typeerror(self):
     """Version._get_other supports only strings or Version as param"""
     v = versions.Version(name='foo', version='1.2.3')
     self.assertRaises(TypeError, v._get_other, 3.4)
Beispiel #27
0
 def test_get_other_typeerror_2(self):
     """Version._get_other - Invalid version strings raises a TypeError"""
     v = versions.Version(name='foo', version='1.2.3')
     self.assertRaises(TypeError, v._get_other, '1')
Beispiel #28
0
    def test_d(self):
        """Version the not equals operator works with strings"""
        v1 = versions.Version(version='1.2.3', name='foo')

        self.assertTrue(v1 != '3.4')
Beispiel #29
0
    def test_e(self):
        """Version - The less than operator works with strings"""
        v1 = versions.Version(version='1.2.1', name='foo')

        self.assertTrue(v1 < '3.4.5.6')
Beispiel #30
0
    def test_minor_property(self):
        """Version.minor is read only"""
        v1 = versions.Version(version='1.2.3', name='foo')
        expected = 2

        self.assertEqual(v1.minor, expected)