Make WordPress Core

Ticket #10656: wp-test.py

File wp-test.py, 824 bytes (added by Sewar, 15 years ago)

This script could be used to test XML-RPC functions of Wordpress, including post meta.

Line 
1#!/usr/bin/python
2#
3
4import sys, os
5import xmlrpclib
6
7title = "Testing XML-RPC serializing bug"
8
9array2 = [{"var1" : "sd", "title" : "Why"},
10                {"var1" : "ds", "title" : "thiS"}]
11array1 = {"array" : "Not Working?",
12                "songs" : array2}
13
14post = {'title' : title,
15                'wp_slug' : title,
16                'categories' : ["Uncategorized"],
17                'custom_fields' : [{'key' : 'no_serializing', 'value' : title},
18                                                        {'key' : 'test', 'value' : array1},
19                                                        {'key' : 'links', 'value' : ['http://core.trac.wordpress.org/ticket/10656', 'http://core.trac.wordpress.org/attachment/ticket/10656/wordpress_xmlrpc_custom_serialized.patch']}]}
20
21username = ''
22password = ''
23wordpress = xmlrpclib.ServerProxy('http://loaclhost/wordpress/xmlrpc.php')
24postid = int(wordpress.metaWeblog.newPost(1, username, password, post, 1))
25print "Post #%s added" % (postid)