Exemple #1
0
 def test_set_setting(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     with patch.dict(logrotate.__salt__,
                     {'file.replace': MagicMock(return_value=True)}):
         self.assertTrue(logrotate.set_('/var/log/wtmp', 'rotate', '2'))
Exemple #2
0
 def test_set_setting(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     ret = ('Error: A setting for a dict was declared, '
            'but the configuration line given is not a dict')
     self.assertEqual(logrotate.set_('rotate', '2', True), ret)
Exemple #3
0
 def test_set(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     ret = ('Error: rotate includes a dict, and a specific '
            'setting inside the dict was not declared')
     self.assertEqual(logrotate.set_('rotate', '2'), ret)
Exemple #4
0
 def test_set_setting(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     with patch.dict(logrotate.__salt__,
                     {'file.replace': MagicMock(return_value=True)}):
         self.assertTrue(logrotate.set_('/var/log/wtmp', 'rotate', '2'))
 def test_set_setting(self):
     """
     Test if it set a new value for a specific configuration line
     """
     with patch.dict(logrotate.__salt__,
                     {"file.replace": MagicMock(return_value=True)}), patch(
                         "salt.modules.logrotate._parse_conf",
                         MagicMock(return_value=PARSE_CONF)):
         self.assertTrue(logrotate.set_("/var/log/wtmp", "rotate", "2"))
Exemple #6
0
 def test_set(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     with patch('salt.modules.logrotate._parse_conf',
                MagicMock(return_value=PARSE_CONF)), \
             patch.dict(logrotate.__salt__,
                        {'file.replace': MagicMock(return_value=True)}):
         self.assertTrue(logrotate.set_('rotate', '2'))
Exemple #7
0
 def test_set_setting(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     ret = (
            'Error: A setting for a dict was declared, '
            'but the configuration line given is not a dict'
            )
     self.assertEqual(logrotate.set_('rotate', '2', True), ret)
Exemple #8
0
 def test_set(self):
     '''
     Test if it set a new value for a specific configuration line
     '''
     ret = (
            'Error: rotate includes a dict, and a specific '
            'setting inside the dict was not declared'
            )
     self.assertEqual(logrotate.set_('rotate', '2'), ret)