Пример #1
0
 def test_checksum_root(self):
     '''
     Test if checksum validate as expected, using the parameter
     root
     '''
     mock = MagicMock(side_effect=[True, 0])
     with patch.dict(rpm.__salt__, {
             'file.file_exists': mock,
             'cmd.retcode': mock
     }):
         rpm.checksum("file1.rpm", root='/')
         self.assertTrue(_called_with_root(mock))
Пример #2
0
    def test_checksum(self):
        '''
        Test if checksum validate as expected
        '''
        ret = {
            "file1.rpm": True,
            "file2.rpm": False,
            "file3.rpm": False,
        }

        mock = MagicMock(side_effect=[True, 0, True, 1, False, 0])
        with patch.dict(rpm.__salt__, {'file.file_exists': mock, 'cmd.retcode': mock}):
            self.assertDictEqual(rpm.checksum("file1.rpm", "file2.rpm", "file3.rpm"), ret)
Пример #3
0
    def test_checksum(self):
        '''
        Test if checksum validate as expected
        '''
        ret = {
            "file1.rpm": True,
            "file2.rpm": False,
            "file3.rpm": False,
        }

        mock = MagicMock(side_effect=[True, 0, True, 1, False, 0])
        with patch.dict(rpm.__salt__, {'file.file_exists': mock, 'cmd.retcode': mock}):
            self.assertDictEqual(rpm.checksum("file1.rpm", "file2.rpm", "file3.rpm"), ret)