#NEWLINE# @ istest #NEWLINE# def creates_a_database_if_it_doesnt_exist_yet( self ) : #NEWLINE# #INDENT# with patch . object ( self . role , 'is_database_present' ) as is_database_present , self . execute_mock ( ) as execute : #NEWLINE# #INDENT# is_database_present . return_value = False #NEWLINE# result = self . role . ensure_database ( 'my_data' ) #NEWLINE# self . assertTrue ( result ) #NEWLINE# execute . assert_called_with ( 'mysql -u root -e "CREATE DATABASE my_data" mysql' , sudo = True , stdout = False )