#NEWLINE# @ mock . patch . object ( profiles . NetworkProfile , 'AddPayload' ) #NEWLINE# @ mock . patch . object ( profiles . certs , 'Certificate' ) #NEWLINE# def testAddAnchorCertificateSuccess( self , mock_certificate , mock_addpayload ) : #NEWLINE# #INDENT# mock_certobj = mock . MagicMock ( ) #NEWLINE# mock_certobj . subject_cn = 'My Cert Subject' #NEWLINE# mock_certobj . osx_fingerprint = '0011223344556677889900' #NEWLINE# mock_certificate . return_value = self #NEWLINE# profile = profiles . NetworkProfile ( 'testuser' ) #NEWLINE# profile . AddAnchorCertificate ( 'my_cert' ) #NEWLINE# mock_certificate . assert_called_once_with ( 'my_cert' ) #NEWLINE# mock_addpayload . assert_called_once_with ( { #NEWLINE# #INDENT# profiles . PAYLOADKEYS_IDENTIFIER : 'com.megacorp.networkprofile.0011223344556677889900' , #NEWLINE# profiles . PAYLOADKEYS_TYPE : 'com.apple.security.pkcs1' , #NEWLINE# profiles . PAYLOADKEYS_DISPLAYNAME : 'My Cert Subject' , #NEWLINE# profiles . PAYLOADKEYS_CONTENT : profiles . plistlib . Data ( 'my_cert' ) , #NEWLINE# profiles . PAYLOADKEYS_ENABLED : True , #NEWLINE# profiles . PAYLOADKEYS_VERSION : 1 , #NEWLINE# profiles . PAYLOADKEYS_UUID : mock . ANY , #NEWLINE# #UNINDENT# } )