def test_compiler_compile(patch, magic): patch.many(JSONCompiler, ['parse_tree']) patch.object(Lines, 'entrypoint') tree = magic() result = JSONCompiler(story=None).compile(tree) JSONCompiler.parse_tree.assert_called_with(tree) lines = JSONCompiler(story=None).lines expected = {'tree': lines.lines, 'version': version, 'services': lines.get_services(), 'functions': lines.functions, 'entrypoint': lines.entrypoint()} assert result == expected
def test_compiler_compile(patch, magic): patch.many(JSONCompiler, ["parse_tree"]) patch.object(Lines, "entrypoint") tree = magic() result = JSONCompiler(story=None).compile(tree) JSONCompiler.parse_tree.assert_called_with(tree) lines = JSONCompiler(story=None).lines expected = { "tree": lines.lines, "version": version, "services": lines.get_services(), "functions": lines.functions, "entrypoint": lines.entrypoint(), } assert result == expected