def test_update_mutation_outputs(self): # create the list of inputs inputs = update_mutation_outputs(self.model_service) # the output of an update mutation should be a graphql object corresponding # to the newly updated object assert inputs == [_summarize_o_mutation_type(self.model_service.model)], ( "Update mutation output was not correct." )
def test_update_mutation_outputs(self): # create the list of inputs inputs = update_mutation_outputs(self.model_service) # the output of an update mutation should be a graphql object corresponding # to the newly updated object assert inputs == [ _summarize_o_mutation_type(self.model_service.model) ], ("Update mutation output was not correct.")
def test_can_summarize_model_mutations(self): # summarize the service summarized = self.service.summarize() # the target summary target = { 'mutations': [ { 'name': api_conventions.crud_mutation_name(action='create', model=self.model), 'event': conventions.get_crud_action(method='create', model=self.model), 'isAsync': False, 'inputs': api_conventions.create_mutation_inputs(self), 'outputs': api_conventions.create_mutation_outputs(self), }, { 'name': api_conventions.crud_mutation_name(action='update', model=self.model), 'event': conventions.get_crud_action(method='update', model=self.model), 'isAsync': False, 'inputs': api_conventions.update_mutation_inputs(self), 'outputs': api_conventions.update_mutation_outputs(self), }, { 'name': api_conventions.crud_mutation_name(action='delete', model=self.model), 'event': conventions.get_crud_action(method='delete', model=self.model), 'isAsync': False, 'inputs': api_conventions.delete_mutation_inputs(self), 'outputs': api_conventions.delete_mutation_outputs(self), }, ] } # make sure the mutations match assert len(target['mutations']) == len(summarized['mutations']), ( "Incorrect number of mutations in summary." ) # go over every mutation in the for summarized_mutation in summarized['mutations']: # grab the corresponding entry in the target equiv = [mut for mut in target['mutations'] \ if mut['name'] == summarized_mutation['name']][0] # make sure the fields match up assert equiv['event'] == summarized_mutation['event'], ( "Summarized mutation has the wrong event value" ) assert equiv['isAsync'] == summarized_mutation['isAsync'], ( "Summarized mutation has the wrong isAsync value" )