Exemple #1
0
    def test_version_cmp_fallback(self):
        '''
        Test package version is called RPM version if RPM-Python is installed

        :return:
        '''
        with patch('salt.modules.rpm.rpm.labelCompare', MagicMock(return_value=0)):
            self.assertEqual(-1, rpm.version_cmp('1', '2'))  # mock returns -1, a python implementation was called
Exemple #2
0
    def test_version_cmp_rpm(self):
        '''
        Test package version is called RPM version if RPM-Python is installed

        :return:
        '''
        with patch('salt.modules.rpm.rpm.labelCompare', MagicMock(return_value=0)):
            self.assertEqual(0, rpm.version_cmp('1', '2'))  # mock returns 0, which means RPM was called
Exemple #3
0
    def test_version_cmp_fallback(self):
        '''
        Test package version is called RPM version if RPM-Python is installed

        :return:
        '''
        rpm.rpm = MagicMock(return_value=MagicMock)
        with patch('salt.modules.rpm.rpm.labelCompare', MagicMock(return_value=0)):
            self.assertEqual(-1, rpm.version_cmp('1', '2'))  # mock returns -1, a python implementation was called
Exemple #4
0
    def test_version_cmp_rpm(self):
        '''
        Test package version is called RPM version if RPM-Python is installed

        :return:
        '''
        rpm.rpm = MagicMock(return_value=MagicMock)
        with patch('salt.modules.rpm.rpm.labelCompare', MagicMock(return_value=0)):
            self.assertEqual(0, rpm.version_cmp('1', '2'))  # mock returns 0, which means RPM was called