aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2012-08-29 09:44:37 -0400
committerW. Trevor King <wking@tremily.us>2012-08-29 23:29:46 -0400
commit3ef47dbe8fbd0161c3f4dd6d75a91fd2154a8f27 (patch)
tree640779cd795b89738f56d0ec2994ea298c0a8085
parent299ca4e57646921babf4dbbf95f28885549519b6 (diff)
downloadbugseverywhere-3ef47dbe8fbd0161c3f4dd6d75a91fd2154a8f27.tar.gz
bug: add doctest for Bug.xml().
-rw-r--r--libbe/bug.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index 7cf1bf8..d77c8c3 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -317,6 +317,60 @@ class Bug (settings_object.SavedSettingsObject):
return output
def xml(self, indent=0, show_comments=False):
+ """
+ >>> bugA = Bug(uuid='0123', summary='Need to test Bug.xml()')
+ >>> bugA.uuid = 'bugA'
+ >>> bugA.time_string = 'Thu, 01 Jan 1970 00:00:00 +0000'
+ >>> bugA.creator = u'Frank'
+ >>> bugA.extra_strings += ['TAG: very helpful']
+ >>> commA = bugA.comment_root.new_reply(body='comment A')
+ >>> commA.uuid = 'commA'
+ >>> commA.date = 'Thu, 01 Jan 1970 00:01:00 +0000'
+ >>> commB = commA.new_reply(body='comment B')
+ >>> commB.uuid = 'commB'
+ >>> commB.date = 'Thu, 01 Jan 1970 00:02:00 +0000'
+ >>> commC = commB.new_reply(body='comment C')
+ >>> commC.uuid = 'commC'
+ >>> commC.date = 'Thu, 01 Jan 1970 00:03:00 +0000'
+ >>> xml = bugA.xml(show_comments=True)
+ >>> print(xml) # doctest: +REPORT_UDIFF
+ <bug>
+ <uuid>bugA</uuid>
+ <short-name>/bug</short-name>
+ <severity>minor</severity>
+ <status>open</status>
+ <creator>Frank</creator>
+ <created>Thu, 01 Jan 1970 00:00:00 +0000</created>
+ <summary>Need to test Bug.xml()</summary>
+ <extra-string>TAG: very helpful</extra-string>
+ <comment>
+ <uuid>commA</uuid>
+ <short-name>/bug/commA</short-name>
+ <author></author>
+ <date>Thu, 01 Jan 1970 00:01:00 +0000</date>
+ <content-type>text/plain</content-type>
+ <body>comment A</body>
+ </comment>
+ <comment>
+ <uuid>commB</uuid>
+ <short-name>/bug/commB</short-name>
+ <in-reply-to>commA</in-reply-to>
+ <author></author>
+ <date>Thu, 01 Jan 1970 00:02:00 +0000</date>
+ <content-type>text/plain</content-type>
+ <body>comment B</body>
+ </comment>
+ <comment>
+ <uuid>commC</uuid>
+ <short-name>/bug/commC</short-name>
+ <in-reply-to>commB</in-reply-to>
+ <author></author>
+ <date>Thu, 01 Jan 1970 00:03:00 +0000</date>
+ <content-type>text/plain</content-type>
+ <body>comment C</body>
+ </comment>
+ </bug>
+ """
if self.time == None:
timestring = ""
else: