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

Unified Diff: tests/presubmit_unittest.py

Issue 7082029: Use m['approval'] instead of looking at the text for 'lgtm'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 7 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 | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index e0c87057321fcbfff21738145c659ae67c8f7712..0d257368c93aa956e6a0884ba708a46c48596dab 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -2029,11 +2029,12 @@ mac|success|blew
expected_host = host_url
owner_email = 'john@example.com'
- messages = list('{"sender": "' + a + '","text": "lgtm"}' for
- a in approvers)
if not rietveld_response:
- rietveld_response = ('{"owner_email": "' + owner_email + '",'
- '"messages": [' + ','.join(messages) + ']}')
+ messages = (
+ '{"sender": "%s", "text": "I approve", "approval": true}' % a
+ for a in approvers)
+ rietveld_response = '{"owner_email": "%s", "messages": [%s]}' % (
+ owner_email, ','.join(messages))
input_api.urllib2.urlopen(
expected_host + '/api/1?messages=true').AndReturn(
StringIO.StringIO(rietveld_response))
@@ -2050,33 +2051,21 @@ mac|success|blew
self.assertEquals(output.getvalue(), expected_output)
def testCannedCheckOwners_LGTMPhrases(self):
- def phrase_test(phrase, approvers=None, expected_output=''):
+ def phrase_test(approval, approvers=None, expected_output=''):
if approvers is None:
approvers = set(['ben@example.com'])
self.AssertOwnersWorks(approvers=approvers,
- rietveld_response='{"owner_email": "john@example.com",' +
- '"messages": [{"sender": "ben@example.com",' +
- '"text": "' + phrase + '"}]}',
+ rietveld_response=(
+ '{"owner_email": "john@example.com",'
+ '"messages": [{"sender": "ben@example.com",'
+ ' "text": "foo", "approval": %s}]}') % approval,
expected_output=expected_output)
- phrase_test('LGTM')
- phrase_test('\\nlgtm')
- phrase_test('> foo\\n> bar\\nlgtm\\n')
- phrase_test('> LGTM', approvers=set(),
+ phrase_test('true')
+ phrase_test('false', approvers=set(),
expected_output='Missing LGTM from someone other than '
'john@example.com\n')
- # TODO(dpranke): these probably should pass.
- phrase_test('Looks Good To Me', approvers=set(),
- expected_output='Missing LGTM from someone other than '
- 'john@example.com\n')
- phrase_test('looks good to me', approvers=set(),
- expected_output='Missing LGTM from someone other than '
- 'john@example.com\n')
-
- # TODO(dpranke): this probably shouldn't pass.
- phrase_test('no lgtm for you')
-
def testCannedCheckOwners_HTTPS_HostURL(self):
self.AssertOwnersWorks(approvers=set(['ben@example.com']),
host_url='https://localhost')
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698