#NEWLINE# def test_write_integer_match( self ) : #NEWLINE# #INDENT# '\n            Test writing a default setting with a integer that is already set to the same value\n        ' #NEWLINE# expected = { #NEWLINE# #INDENT# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'comment' : 'com.apple.something Key is already set to 1337' , #NEWLINE# 'name' : 'Key' , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } #NEWLINE# read_mock = MagicMock ( return_value = '1337' ) #NEWLINE# write_mock = MagicMock ( return_value = { #NEWLINE# #INDENT# 'retcode' : 0 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with patch . dict ( macdefaults . __salt__ , { #NEWLINE# #INDENT# 'macdefaults.read' : read_mock , #NEWLINE# 'macdefaults.write' : write_mock , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# out = macdefaults . write ( 'Key' , 'com.apple.something' , 1337 , vtype = 'integer' ) #NEWLINE# read_mock . assert_called_once_with ( 'com.apple.something' , 'Key' , None ) #NEWLINE# assert ( not write_mock . called ) #NEWLINE# self . assertEqual ( out , out )