Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: tests/rietveld_test.py

Issue 6877038: Improve patch handling and tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/patch_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/rietveld_test.py
diff --git a/tests/rietveld_test.py b/tests/rietveld_test.py
index 6a32f64e4561159f1a6152198988b143c20453ce..6c81454ac83f1ee5f5c0be66ce117450438a58b5 100755
--- a/tests/rietveld_test.py
+++ b/tests/rietveld_test.py
@@ -21,24 +21,16 @@ import rietveld
class RietveldTest(unittest.TestCase):
- def setUp(self):
- super(RietveldTest, self).setUp()
- self._rietveld_send = rietveld.Rietveld._send
- rietveld.Rietveld._send = None
-
- def tearDown(self):
- super(RietveldTest, self).setUp()
- rietveld.Rietveld._send = self._rietveld_send
-
def test_get_patch_empty(self):
- rietveld.Rietveld._send = lambda x, y, payload: '{}'
r = rietveld.Rietveld('url', 'email', 'password')
+ r._send = lambda *args, **kwargs: '{}'
patches = r.get_patch(123, 456)
self.assertTrue(isinstance(patches, patch.PatchSet))
self.assertEquals([], patches.patches)
def test_get_patch_no_status(self):
- rietveld.Rietveld._send = lambda x, y, payload: (
+ r = rietveld.Rietveld('url', 'email', 'password')
+ r._send = lambda *args, **kwargs: (
'{'
' "files":'
' {'
@@ -47,7 +39,6 @@ class RietveldTest(unittest.TestCase):
' }'
' }'
'}')
- r = rietveld.Rietveld('url', 'email', 'password')
try:
r.get_patch(123, 456)
self.fail()
@@ -68,8 +59,8 @@ class RietveldTest(unittest.TestCase):
' }'
' }'
'}')
- rietveld.Rietveld._send = lambda x, y, payload: output
r = rietveld.Rietveld('url', 'email', 'password')
+ r._send = lambda *args, **kwargs: output
patches = r.get_patch(123, 456)
self.assertTrue(isinstance(patches, patch.PatchSet))
self.assertEquals(1, len(patches.patches))
« no previous file with comments | « tests/patch_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698