def test_compiler_mutation_block_from_service(patch, compiler, lines, tree): patch.many(Objects, ['path', 'mutation_fragment']) patch.object(JSONCompiler, 'chained_mutations', return_value=['chained']) tree.nested_block = None tree.data = 'mutation_block' compiler.mutation_block(tree, None) Objects.path.assert_called_with(tree.path) Objects.mutation_fragment.assert_called_with(tree.mutation_fragment) JSONCompiler.chained_mutations.assert_called_with(tree) args = [Objects.path(), Objects.mutation_fragment(), 'chained'] kwargs = {'args': args, 'parent': None} lines.append.assert_called_with('mutation', tree.position(), **kwargs)
def test_compiler_mutation_block_from_service(patch, compiler, lines, tree): patch.many(Objects, ["path", "mutation_fragment"]) patch.object(JSONCompiler, "chained_mutations", return_value=["chained"]) tree.nested_block = None tree.data = "mutation_block" compiler.mutation_block(tree, None) Objects.path.assert_called_with(tree.path) Objects.mutation_fragment.assert_called_with(tree.mutation_fragment) JSONCompiler.chained_mutations.assert_called_with(tree) args = [Objects.path(), Objects.mutation_fragment(), "chained"] kwargs = {"args": args, "parent": None} lines.append.assert_called_with("mutation", tree.position(), **kwargs)