示例#1
0
 def test_read_file(self):
     '''
     Test if the parsing function works
     '''
     with patch('salt.utils.files.fopen', mock_open(read_data=MOCK_FILE)):
         self.assertListEqual(pam.read_file('/etc/pam.d/login'),
                              [{'arguments': [], 'control_flag': 'ok',
                                'interface': 'ok', 'module': 'ignore'}])
示例#2
0
文件: pam_test.py 项目: bryson/salt
 def test_read_file(self):
     '''
     Test if the parsing function works
     '''
     with patch('salt.utils.fopen', mock_open(read_data=MOCK_FILE)):
         self.assertListEqual(pam.read_file('/etc/pam.d/login'),
                              [{'arguments': [], 'control_flag': 'ok',
                                'interface': 'ok', 'module': 'ignore'}])
示例#3
0
 def test_read_file(self):
     """
     Test if the parsing function works
     """
     with patch("os.path.exists",
                return_value=True), patch("salt.utils.files.fopen",
                                          mock_open(read_data=MOCK_FILE)):
         self.assertListEqual(
             pam.read_file("/etc/pam.d/login"),
             [{
                 "arguments": [],
                 "control_flag": "ok",
                 "interface": "ok",
                 "module": "ignore",
             }],
         )