#NEWLINE# @ patch ( 'ramses.models.resource_schema' ) #NEWLINE# @ patch ( 'ramses.models.generate_model_cls' ) #NEWLINE# @ patch ( 'ramses.models.get_existing_model' ) #NEWLINE# def test_setup_data_model_success( self , mock_get , mock_gen , mock_schema ) : #NEWLINE# #INDENT# from ramses import models #NEWLINE# mock_get . return_value = None #NEWLINE# mock_schema . return_value = { #NEWLINE# #INDENT# 'field1' : 'val1' , #NEWLINE# #UNINDENT# } #NEWLINE# config = config_mock ( ) #NEWLINE# model = models . setup_data_model ( config , 'foo' , 'Bar' ) #NEWLINE# mock_get . assert_called_once_with ( 'Bar' ) #NEWLINE# mock_schema . assert_called_once_with ( 'foo' ) #NEWLINE# mock_gen . assert_called_once_with ( config , schema = { #NEWLINE# #INDENT# 'field1' : 'val1' , #NEWLINE# #UNINDENT# } , model_name = 'Bar' , raml_resource = 'foo' ) #NEWLINE# assert ( model == mock_gen ( ) )