Added "Created comment..." output to `be comment`
authorW. Trevor King <wking@drexel.edu>
Sat, 23 Jan 2010 20:56:14 +0000 (15:56 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 23 Jan 2010 20:56:14 +0000 (15:56 -0500)
NEWS
libbe/command/comment.py

diff --git a/NEWS b/NEWS
index 17d5aee88d4188132d53b1697f3b3da009e9204b..cee98ea8a8dc95ab0e5a15373a83d8a22d860b7b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+January 23, 2010
+ * Added 'Created comment with ID .../.../...' output to `be comment`
+
 January 20, 2010
  * Renamed 'be-mbox-to-xml' -> 'be-mail-to-xml' and added support for
    several mailbox formats.
index 16b0e772302a19e9632318558bab196e8a5a3236..b82576a9f0ec37dba222ca1f157d28ba2dc01c34 100644 (file)
@@ -32,6 +32,7 @@ class Comment (libbe.command.Command):
 
     >>> import time
     >>> import libbe.bugdir
+    >>> import libbe.util.id
     >>> bd = libbe.bugdir.SimpleBugDir(memory=False)
     >>> io = libbe.command.StringInputOutput()
     >>> io.stdout = sys.stdout
@@ -39,8 +40,12 @@ class Comment (libbe.command.Command):
     >>> ui.storage_callbacks.set_storage(bd.storage)
     >>> cmd = Comment(ui=ui)
 
+    >>> uuid_gen = libbe.util.id.uuid_gen
+    >>> libbe.util.id.uuid_gen = lambda: 'X'
     >>> ui._user_id = u'Fran\\xe7ois'
     >>> ret = ui.run(cmd, args=['/a', 'This is a comment about a'])
+    Created comment with ID abc/a/X
+    >>> libbe.util.id.uuid_gen = uuid_gen
     >>> bd.flush_reload()
     >>> bug = bd.bug_from_uuid('a')
     >>> bug.load_comments(load_full=False)
@@ -65,7 +70,10 @@ class Comment (libbe.command.Command):
     UserError: No comment supplied, and EDITOR not specified.
 
     >>> os.environ['EDITOR'] = "echo 'I like cheese' > "
+    >>> libbe.util.id.uuid_gen = lambda: 'Y'
     >>> ret = ui.run(cmd, args=['/b'])
+    Created comment with ID abc/b/Y
+    >>> libbe.util.id.uuid_gen = uuid_gen
     >>> bd.flush_reload()
     >>> bug = bd.bug_from_uuid('b')
     >>> bug.load_comments(load_full=False)
@@ -143,6 +151,7 @@ class Comment (libbe.command.Command):
         for key in ['alt-id', 'author', 'content-type']:
             if params[key] != None:
                 setattr(new, key, params[key])
+        print >> self.stdout, 'Created comment with ID %s' % new.id.user()
         return 0
 
     def _long_help(self):