Revert of git_cl: Add the ability to set the description. (patchset #3 id:40001 of https://codereview.chromium.org/1922133006/ )
Reason for revert:
splitlines man
Original issue's description:
> git_cl: Add the ability to set the description.
>
> BUG=607359
>
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=300357
TBR=iannucci@chromium.org,tandrii@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=607359
Review-Url: https://codereview.chromium.org/1935633002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300360 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 9b506fe..571be65 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -21,19 +21,6 @@
import git_footers
import subprocess2
-class ChangelistMock():
- # A class variable so we can access it when we don't have access to the
- # instance that's being set.
- desc = ""
- def __init__(self, **kwargs):
- pass
- def GetIssue(self):
- return 1
- def GetDescription(self):
- return ChangelistMock.desc
- def UpdateDescription(self, desc):
- ChangelistMock.desc = desc
-
class PresubmitMock(object):
def __init__(self, *args, **kwargs):
self.reviewers = []
@@ -1398,8 +1385,15 @@
out = StringIO.StringIO()
self.mock(git_cl.sys, 'stdout', out)
- self.mock(git_cl, 'Changelist', ChangelistMock)
- ChangelistMock.desc = 'foo\n'
+ class MockChangelist():
+ def __init__(self, **kwargs):
+ pass
+ def GetIssue(self):
+ return 1
+ def GetDescription(self):
+ return 'foo'
+
+ self.mock(git_cl, 'Changelist', MockChangelist)
self.assertEqual(0, git_cl.main(['description', '-d']))
self.assertEqual('foo\n', out.getvalue())
@@ -1429,34 +1423,6 @@
'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)
-
- self.mock(git_cl, 'Changelist', ChangelistMock)
- class TMP():
- def splitlines(self):
- return ['hihi']
-
- self.mock(git_cl.sys, 'stdin', TMP())
-
- self.assertEqual(0, git_cl.main(['description', '-n', 'hihi']))
- self.assertEqual('hihi', ChangelistMock.desc)
-
- def test_description_set_stdin(self):
- out = StringIO.StringIO()
- self.mock(git_cl.sys, 'stdout', out)
-
- self.mock(git_cl, 'Changelist', ChangelistMock)
- class TMP():
- def splitlines(self):
- return ['hi', 'there']
-
- self.mock(git_cl.sys, 'stdin', TMP())
-
- self.assertEqual(0, git_cl.main(['description', '-n', '-']))
- self.assertEqual('hi\nthere', ChangelistMock.desc)
-
if __name__ == '__main__':
git_cl.logging.basicConfig(