Index: tests/git_cl_test.py |
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py |
index 571be654aa717d37e5f4fa1fd8680a1529d904cd..def78e603a15e54cc40ce7ab2310671ca337c653 100755 |
--- a/tests/git_cl_test.py |
+++ b/tests/git_cl_test.py |
@@ -1423,6 +1423,47 @@ class TestGitCl(TestCase): |
'description', 'https://code.review.org/123123', '-d', '--gerrit'])) |
self.assertEqual('foobar\n', out.getvalue()) |
+ def test_description_set_raw(self): |
+ out = StringIO.StringIO() |
+ self.mock(git_cl.sys, 'stdout', out) |
+ |
+ set_desc = [] |
+ class MockChangelist(): |
+ def __init__(self, **kwargs): |
+ pass |
+ def GetIssue(self): |
+ return 1 |
+ def GetDescription(self): |
+ return 'foo' |
+ def UpdateDescription(self, desc): |
+ set_desc.append(desc) |
+ |
+ self.mock(git_cl, 'Changelist', MockChangelist) |
+ |
+ self.assertEqual(0, git_cl.main(['description', '-n', 'hihi'])) |
+ self.assertEqual('hihi', set_desc[0]) |
+ |
+ def test_description_set_stdin(self): |
+ out = StringIO.StringIO() |
+ self.mock(git_cl.sys, 'stdout', out) |
+ |
+ set_desc = [] |
+ class MockChangelist(): |
+ def __init__(self, **kwargs): |
+ pass |
+ def GetIssue(self): |
+ return 1 |
+ def GetDescription(self): |
+ return 'foo' |
+ def UpdateDescription(self, desc): |
+ set_desc.append(desc) |
+ |
+ self.mock(git_cl, 'Changelist', MockChangelist) |
+ self.mock(git_cl.sys, 'stdin', ['hi', 'there']) |
+ |
+ self.assertEqual(0, git_cl.main(['description', '-n', '-'])) |
+ self.assertEqual('hi\nthere', set_desc[0]) |
+ |
if __name__ == '__main__': |
git_cl.logging.basicConfig( |