#NEWLINE# @ patch ( 'cctrl.user.is_key_valid' ) #NEWLINE# @ patch ( 'cctrl.user.get_user_config' ) #NEWLINE# def test_setup_only_email_provided( self , _get_user_config , _is_key_valid , _set_user_config , * args ) : #NEWLINE# #INDENT# user = UserController ( Mock ( ) , Settings ( ) ) #NEWLINE# user . api . read_users . return_value = [ { #NEWLINE# #INDENT# 'username' : 'foo' , #NEWLINE# #UNINDENT# } ] #NEWLINE# args = Mock ( email = 'info@example.org' , ssh_key_path = None , ssh_auth = None ) #NEWLINE# _get_user_config . return_value = { #NEWLINE# #INDENT# 'ssh_auth' : True , #NEWLINE# 'ssh_path' : '/path/to/key' , #NEWLINE# #UNINDENT# } #NEWLINE# _is_key_valid . return_value = True #NEWLINE# user . setup ( args ) #NEWLINE# self . assertTrue ( user . api . read_users . called ) #NEWLINE# self . assertTrue ( user . api . create_user_key . called ) #NEWLINE# self . assertEqual ( 2 , len ( _set_user_config . mock_calls ) ) #NEWLINE# self . assertEqual ( call ( user . settings , email = 'info@example.org' ) , _set_user_config . mock_calls [ 0 ] ) #NEWLINE# self . assertEqual ( call ( user . settings , ssh_auth = True , ssh_path = '/path/to/key' ) , _set_user_config . mock_calls [ 1 ] )