def test_mount(self): ''' Test mounting an dmg file to a temporary location ''' cmd_mock = MagicMock() temp_mock = MagicMock(return_value='dmg-ABCDEF') with patch.dict(macpackage.__salt__, {'cmd.run': cmd_mock, 'temp.dir': temp_mock}): macpackage.mount('/path/to/file.dmg') temp_mock.assert_called_once_with(prefix='dmg-') cmd_mock.assert_called_once_with('hdiutil attach -readonly -nobrowse -mountpoint ' 'dmg-ABCDEF "/path/to/file.dmg"')