aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-01 01:27:07 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-01 01:27:07 +0200
commit655dcd3b809c80ca6ca2ae001202064dd594df2b (patch)
tree554332b216f36f0957e9bbe09e5f518b409c019b /tests
parent43218b75f3df450b97992815322c2d668ba2bab7 (diff)
downloadbugzilla-triage-655dcd3b809c80ca6ca2ae001202064dd594df2b.tar.gz
Adding unit tests for xmlrpc.js
Diffstat (limited to 'tests')
-rw-r--r--tests/test-xmlrpc.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test-xmlrpc.js b/tests/test-xmlrpc.js
new file mode 100644
index 0000000..afb78c5
--- /dev/null
+++ b/tests/test-xmlrpc.js
@@ -0,0 +1,32 @@
+/*global exports: false, require: false */
+/*jslint plusplus: false */
+"use strict";
+var xrpc = require("xmlrpc");
+var xmlOut = "<?xml version=\"1.0\"?>\n" +
+ "<methodCall>\n<methodName>bugzilla.updateAttachMimeType</methodName>\n" +
+ "<params>\n<param>\n<value><struct>\n<member>\n<name>attach_id</name>\n" +
+ "<value><string>myId</string></value>\n</member>\n<member>\n" +
+ "<name>mime_type</name>\n<value><string>text/plain</string></value>\n</member>\n" +
+ "<member>\n<name>nomail</name>\n<value><string>billg@microsoft.com</string>" +
+ "</value>\n</member>\n</struct>\n</value>\n</param>\n<param>\n" +
+ "<value><string>me@example.com</string></value>\n</param>\n" +
+ "<param>\n<value><string>secret</string></value>\n</param>\n" +
+ "<param>\n<value><double>3.14</double></value>\n</param>\n" +
+ "<param>\n<value><boolean>1</boolean></value>\n</param>\n" +
+ "</params>\n</methodCall>";
+
+// testing xrpc.XMLRPCMessage
+exports.ensureGenerateXMLRPC = function (test) {
+ var msg = new xrpc.XMLRPCMessage("bugzilla.updateAttachMimeType");
+ msg.addParameter({
+ 'attach_id' : "myId",
+ 'mime_type' : "text/plain",
+ 'nomail' : "billg@microsoft.com"
+ });
+ msg.addParameter("me@example.com");
+ msg.addParameter("secret");
+ msg.addParameter(3.14);
+ msg.addParameter(true);
+ test.assertEqual(msg.xml(), xmlOut,
+ "generate XML-RPC message");
+};