示例#1
0
    def test_stats(self):
        '''
        Test if it returns statistics about the locate database
        '''
        ret = {'files': '75,253',
               'directories': '49,252',
               'bytes in file names': '93,214',
               'bytes used to store database': '29,165',
               'database': '/var/lib/mlocate/mlocate.db'}

        mock_ret = '''Database /var/lib/mlocate/mlocate.db:
        49,252 directories 
        75,253 files 
        93,214 bytes in file names 
        29,165 bytes used to store database'''

        with patch.dict(locate.__salt__,
                        {'cmd.run': MagicMock(return_value=mock_ret)}):
            self.assertDictEqual(locate.stats(), ret)
示例#2
0
    def test_stats(self):
        '''
        Test if it returns statistics about the locate database
        '''
        ret = {'files': '75,253',
               'directories': '49,252',
               'bytes in file names': '93,214',
               'bytes used to store database': '29,165',
               'database': '/var/lib/mlocate/mlocate.db'}

        mock_ret = '''Database /var/lib/mlocate/mlocate.db:
        49,252 directories 
        75,253 files 
        93,214 bytes in file names 
        29,165 bytes used to store database'''

        with patch.dict(locate.__salt__,
                        {'cmd.run': MagicMock(return_value=mock_ret)}):
            self.assertDictEqual(locate.stats(), ret)
示例#3
0
    def test_stats(self):
        """
        Test if it returns statistics about the locate database
        """
        ret = {
            "files": "75,253",
            "directories": "49,252",
            "bytes in file names": "93,214",
            "bytes used to store database": "29,165",
            "database": "/var/lib/mlocate/mlocate.db",
        }

        mock_ret = """Database /var/lib/mlocate/mlocate.db:
        49,252 directories 
        75,253 files 
        93,214 bytes in file names 
        29,165 bytes used to store database"""

        with patch.dict(locate.__salt__, {"cmd.run": MagicMock(return_value=mock_ret)}):
            self.assertDictEqual(locate.stats(), ret)