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'}])
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'}])
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", }], )