Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test serializing a ticket with missing/empty description.

  • Loading branch information...
commit f4d0049aef7061f4a866db8b2f5472a108411bc5 1 parent c555314
@tv42 authored
Showing with 89 additions and 4 deletions.
  1. +6 −4 bugit/serialize.py
  2. +83 −0 bugit/test/test_cmd_show.py
View
10 bugit/serialize.py
@@ -51,10 +51,12 @@ def serialize(
break_long_words=False,
)
print >>fp
- description = snapshot.get(os.path.join(ticket, 'description')).rstrip()
- if description:
- print >>fp, description
- print >>fp
+ description = snapshot.get(os.path.join(ticket, 'description'))
+ if description is not None:
+ description = description.rstrip()
+ if description:
+ print >>fp, description
+ print >>fp
print >>fp, '--'
def get_the_rest():
for name in snapshot.ls(ticket):
View
83 bugit/test/test_cmd_show.py
@@ -513,3 +513,86 @@ def test_multiple():
--
""")
+
+def test_description_missing():
+ # not really sure how you could end up without a description, but
+ # let's not totally fail
+ tmp = util.maketemp()
+ storage.git_init(tmp)
+ storage.init(tmp)
+ with storage.Transaction(repo=tmp) as t:
+ t.set(
+ 'd239371f3b6b61ca1076bb460e331b3edb412970/number',
+ '3431\n',
+ )
+ result = util.clitest(
+ args=[
+ 'show',
+ 'd239',
+ ],
+ cwd=tmp,
+ )
+ result.check_stdout("""\
+ticket d239371f3b6b61ca1076bb460e331b3edb412970
+number #3431
+
+--
+""")
+
+def test_description_empty():
+ # not really sure how you could end up without a description, but
+ # let's not totally fail
+ tmp = util.maketemp()
+ storage.git_init(tmp)
+ storage.init(tmp)
+ with storage.Transaction(repo=tmp) as t:
+ t.set(
+ 'd239371f3b6b61ca1076bb460e331b3edb412970/description',
+ '',
+ )
+ t.set(
+ 'd239371f3b6b61ca1076bb460e331b3edb412970/number',
+ '3431\n',
+ )
+ result = util.clitest(
+ args=[
+ 'show',
+ 'd239',
+ ],
+ cwd=tmp,
+ )
+ result.check_stdout("""\
+ticket d239371f3b6b61ca1076bb460e331b3edb412970
+number #3431
+
+--
+""")
+
+def test_description_whitespace():
+ # not really sure how you could end up without a description, but
+ # let's not totally fail
+ tmp = util.maketemp()
+ storage.git_init(tmp)
+ storage.init(tmp)
+ with storage.Transaction(repo=tmp) as t:
+ t.set(
+ 'd239371f3b6b61ca1076bb460e331b3edb412970/description',
+ '\n',
+ )
+ t.set(
+ 'd239371f3b6b61ca1076bb460e331b3edb412970/number',
+ '3431\n',
+ )
+ result = util.clitest(
+ args=[
+ 'show',
+ 'd239',
+ ],
+ cwd=tmp,
+ )
+ result.check_stdout("""\
+ticket d239371f3b6b61ca1076bb460e331b3edb412970
+number #3431
+
+--
+""")

0 comments on commit f4d0049

Please sign in to comment.
Something went wrong with that request. Please try again.