summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-11-12 22:55:12 +0100
committerRicardo Wurmus <rekado@elephly.net>2017-11-12 22:55:12 +0100
commit8d6189b4bc927cd02ac9c1d2a91384d27c8e1b97 (patch)
tree6e3e82124abf4b2fb0db9fcf3ccdb7693fa74af2 /tests
parentb92da4dfbce36ca8e6fe0ac39fe1b132a10a694b (diff)
tests: Add test for get-status operation.
* debbugs/bug.scm (bug?): Export it. * tests/operations.scm: Add two tests. * tests/requests/get-status.xml, tests/responses/get-status1.xml: New files.
Diffstat (limited to 'tests')
-rw-r--r--tests/operations.scm15
-rw-r--r--tests/requests/get-status.xml1
-rw-r--r--tests/responses/get-status1.xml102
3 files changed, 118 insertions, 0 deletions
diff --git a/tests/operations.scm b/tests/operations.scm
index c15bf1b..f7222fb 100644
--- a/tests/operations.scm
+++ b/tests/operations.scm
@@ -19,6 +19,8 @@
(define-module (test-operations)
#:use-module (debbugs operations)
#:use-module (debbugs soap)
+ #:use-module (debbugs bug)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-64)
#:use-module (ice-9 rdelim)
#:use-module (sxml simple))
@@ -30,6 +32,7 @@
"/tests/" name)
read-string))
+
(test-assert "newest-bugs generates soap request"
(soap-request? (newest-bugs 2)))
@@ -44,4 +47,16 @@
(xml->sxml (asset "responses/newest-bugs1.xml")))
(list 881351 881352 881353))
+
+(test-equal "get-status generates soap request XML"
+ (string-trim-both (asset "requests/get-status.xml"))
+ (with-output-to-string
+ (lambda _ (sxml->xml (soap-request-body (get-status (list 1 2 3)))))))
+
+(test-assert "get-status parses response as bugs"
+ (every bug?
+ ((soap-request-callback (get-status (list 1 2 3)))
+ (xml->sxml (asset "responses/get-status1.xml")
+ #:trim-whitespace? #t))))
+
(test-end "operations")
diff --git a/tests/requests/get-status.xml b/tests/requests/get-status.xml
new file mode 100644
index 0000000..07ac787
--- /dev/null
+++ b/tests/requests/get-status.xml
@@ -0,0 +1 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenc:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><soap:Body><ns1:get_status xmlns:ns1="urn:Debbugs/SOAP" soapenc:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns1:bugs xsi:type="soapenc:Array" soapenc:arrayType="xsd:int[3]"><ns1:bugs xsi:type="xsd:int">1</ns1:bugs><ns1:bugs xsi:type="xsd:int">2</ns1:bugs><ns1:bugs xsi:type="xsd:int">3</ns1:bugs></ns1:bugs></ns1:get_status></soap:Body></soap:Envelope>
diff --git a/tests/responses/get-status1.xml b/tests/responses/get-status1.xml
new file mode 100644
index 0000000..5da3188
--- /dev/null
+++ b/tests/responses/get-status1.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:apachens="http://xml.apache.org/xml-soap"
+ xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:xsd="http://www.w3.org/1999/XMLSchema"
+ xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
+ <soap:Body>
+ <get_statusResponse xmlns="urn:Debbugs/SOAP">
+ <s-gensym3 xsi:type="apachens:Map">
+ <item>
+ <key xsi:type="xsd:int">881352</key>
+ <value>
+ <unarchived xsi:type="xsd:string" />
+ <affects xsi:type="xsd:string" />
+ <package xsi:type="xsd:string">udisks2</package>
+ <tags xsi:type="xsd:string" />
+ <keywords xsi:type="xsd:string" />
+ <mergedwith xsi:type="xsd:string" />
+ <outlook xsi:type="xsd:string" />
+ <severity xsi:type="xsd:string">critical</severity>
+ <bug_num xsi:type="xsd:int">881352</bug_num>
+ <location xsi:type="xsd:string">db-h</location>
+ <pending xsi:type="xsd:string">pending</pending>
+ <done xsi:type="xsd:string" />
+ <found xsi:type="apachens:Map">
+ <item>
+ <key xsi:type="xsd:string">udisks2/2.7.4-1</key>
+ <value xsi:type="xsd:string" />
+ </item>
+ </found>
+ <archived xsi:type="xsd:int">0</archived>
+ <fixed_date soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <msgid xsi:type="xsd:string">&lt;CAA2p8qL7_iWtnv_DzTnr+Gk4VwBVO4B9Yn0fF7yN8BP85a_AQg@mail.gmail.com&gt;</msgid>
+ <last_modified xsi:type="xsd:int">1510333025</last_modified>
+ <fixed_versions soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <found_date soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <fixed />
+ <blockedby xsi:type="xsd:string" />
+ <subject xsi:type="xsd:string">udisks2: Breaks installation with kernel panic</subject>
+ <id xsi:type="xsd:int">881352</id>
+ <summary xsi:type="xsd:string" />
+ <log_modified xsi:type="xsd:int">1510333025</log_modified>
+ <found_versions soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array">
+ <item xsi:type="xsd:string">udisks2/2.7.4-1</item>
+ </found_versions>
+ <date xsi:type="xsd:int">1510333022</date>
+ <forwarded xsi:type="xsd:string" />
+ <owner xsi:type="xsd:string" />
+ <originator xsi:type="xsd:base64Binary">QW5kcsOpIEVzdGV2ZXMgPGFpZmVzdGV2ZXNAZ21haWwuY29tPg==</originator>
+ <source xsi:type="xsd:string">udisks2</source>
+ <blocks xsi:type="xsd:string" />
+ </value>
+ </item>
+ <item>
+ <key xsi:type="xsd:int">881353</key>
+ <value>
+ <log_modified xsi:type="xsd:int">1510333743</log_modified>
+ <blockedby xsi:type="xsd:string" />
+ <id xsi:type="xsd:int">881353</id>
+ <subject xsi:type="xsd:string">smb.conf: client max protocol = default limits connections to SMB1</subject>
+ <summary xsi:type="xsd:string" />
+ <found_date soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <fixed />
+ <last_modified xsi:type="xsd:int">1510333743</last_modified>
+ <fixed_versions soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <source xsi:type="xsd:string">samba</source>
+ <blocks xsi:type="xsd:string" />
+ <owner xsi:type="xsd:string" />
+ <originator xsi:type="xsd:string">wolfgang &lt;rnd83@safearea.eu&gt;</originator>
+ <found_versions soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array">
+ <item xsi:type="xsd:string">samba/2:4.5.12+dfsg-2</item>
+ </found_versions>
+ <date xsi:type="xsd:int">1510333741</date>
+ <forwarded xsi:type="xsd:string" />
+ <keywords xsi:type="xsd:string" />
+ <mergedwith xsi:type="xsd:string" />
+ <affects xsi:type="xsd:string" />
+ <package xsi:type="xsd:string">samba-common</package>
+ <tags xsi:type="xsd:string" />
+ <unarchived xsi:type="xsd:string" />
+ <fixed_date soapenc:arrayType="xsd:ur-type[0]" xsi:type="soapenc:Array" />
+ <msgid xsi:type="xsd:string">&lt;151033356604.2622.17810452636805039427.reportbug@aerocool&gt;</msgid>
+ <found xsi:type="apachens:Map">
+ <item>
+ <key xsi:type="xsd:string">samba/2:4.5.12+dfsg-2</key>
+ <value xsi:type="xsd:string" />
+ </item>
+ </found>
+ <done xsi:type="xsd:string" />
+ <archived xsi:type="xsd:int">0</archived>
+ <location xsi:type="xsd:string">db-h</location>
+ <pending xsi:type="xsd:string">pending</pending>
+ <outlook xsi:type="xsd:string" />
+ <severity xsi:type="xsd:string">normal</severity>
+ <bug_num xsi:type="xsd:int">881353</bug_num>
+ </value>
+ </item>
+ </s-gensym3>
+ </get_statusResponse>
+ </soap:Body>
+</soap:Envelope>