blob: 4def219e628885f14717151164308ace444b14a0 [file] [log] [blame]
#!/usr/bin/python -tt
#
# testclient_sendfile.py
# XML-RPC test client which just sends an XML file to the given rteval server
#
# Copyright 2009 - 2013 David Sommerseth <davids@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# For the avoidance of doubt the "preferred form" of this code is one which
# is in an open unpatent encumbered format. Where cryptographic key signing
# forms part of the process of creating an executable the information
# including keys needed to generate an equivalently functional executable
# are deemed to be part of the source code.
#
import sys
import libxml2
from optparse import OptionParser
sys.path.append('../rteval')
import rtevalclient
if __name__ == '__main__':
parser = OptionParser(version="%prog v0.1")
parser.add_option("-r", "--report", action="store", dest="report", default="summary.xml",
help="Which XML report to send to the XML-RPC server (default: %default)",
metavar="FILE")
parser.add_option("-X", "--xmlrpc-submit", dest="xmlrpchost", default="localhost:65432",
help="Hostname to the XML-RPC server to send the data (default: %default)",
metavar="HOST[:PORT]")
(opts, args) = parser.parse_args()
d = libxml2.parseFile(opts.report)
client = rtevalclient.rtevalclient("http://%s/rteval/API1/" % opts.xmlrpchost)
status = client.SendReport(d)
print "SendReport(xmlDoc): %s" % status
else:
raise Exception, "This is a standalone program, not a module to be imported"