| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for git_cl.py.""" | 6 """Unit tests for git_cl.py.""" |
| 7 | 7 |
| 8 import json | 8 import json |
| 9 import os | 9 import os |
| 10 import StringIO | 10 import StringIO |
| (...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 u'revision': None}], | 1943 u'revision': None}], |
| 1944 u'properties': { | 1944 u'properties': { |
| 1945 u'category': u'git_cl_try', | 1945 u'category': u'git_cl_try', |
| 1946 u'issue': 123, | 1946 u'issue': 123, |
| 1947 u'key': u'val', | 1947 u'key': u'val', |
| 1948 u'json': [{u'a': 1}, None], | 1948 u'json': [{u'a': 1}, None], |
| 1949 u'master': u'tryserver.chromium', | 1949 u'master': u'tryserver.chromium', |
| 1950 u'patch_project': u'depot_tools', | 1950 u'patch_project': u'depot_tools', |
| 1951 u'patch_storage': u'rietveld', | 1951 u'patch_storage': u'rietveld', |
| 1952 u'patchset': 20001, | 1952 u'patchset': 20001, |
| 1953 u'reason': u'feature', # This is a branch name, but why? | |
| 1954 u'rietveld': u'https://codereview.chromium.org', | 1953 u'rietveld': u'https://codereview.chromium.org', |
| 1955 } | 1954 } |
| 1956 }) | 1955 }) |
| 1957 self.assertEqual(build, { | 1956 self.assertEqual(build, { |
| 1958 u'bucket': u'master.tryserver.chromium', | 1957 u'bucket': u'master.tryserver.chromium', |
| 1959 u'client_operation_id': u'uuid4', | 1958 u'client_operation_id': u'uuid4', |
| 1960 u'tags': [u'builder:win', | 1959 u'tags': [u'builder:win', |
| 1961 u'buildset:patch/rietveld/codereview.chromium.org/123/20001', | 1960 u'buildset:patch/rietveld/codereview.chromium.org/123/20001', |
| 1962 u'user_agent:git_cl_try', | 1961 u'user_agent:git_cl_try', |
| 1963 u'master:tryserver.chromium'], | 1962 u'master:tryserver.chromium'], |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 self.assertEqual(params, { | 1996 self.assertEqual(params, { |
| 1998 u'builder_name': u'win', | 1997 u'builder_name': u'win', |
| 1999 u'changes': [{u'author': {u'email': u'owner@e.mail'}, | 1998 u'changes': [{u'author': {u'email': u'owner@e.mail'}, |
| 2000 u'revision': None}], | 1999 u'revision': None}], |
| 2001 u'properties': { | 2000 u'properties': { |
| 2002 u'category': u'git_cl_try', | 2001 u'category': u'git_cl_try', |
| 2003 u'issue': 123, | 2002 u'issue': 123, |
| 2004 u'patch_project': u'depot_tools', | 2003 u'patch_project': u'depot_tools', |
| 2005 u'patch_storage': u'rietveld', | 2004 u'patch_storage': u'rietveld', |
| 2006 u'patchset': 20001, | 2005 u'patchset': 20001, |
| 2007 u'reason': u'feature', # This is a branch name, but why? | |
| 2008 u'rietveld': u'https://codereview.chromium.org', | 2006 u'rietveld': u'https://codereview.chromium.org', |
| 2009 } | 2007 } |
| 2010 }) | 2008 }) |
| 2011 self.assertEqual(build, { | 2009 self.assertEqual(build, { |
| 2012 u'bucket': u'test.bucket', | 2010 u'bucket': u'test.bucket', |
| 2013 u'client_operation_id': u'uuid4', | 2011 u'client_operation_id': u'uuid4', |
| 2014 u'tags': [u'builder:win', | 2012 u'tags': [u'builder:win', |
| 2015 u'buildset:patch/rietveld/codereview.chromium.org/123/20001', | 2013 u'buildset:patch/rietveld/codereview.chromium.org/123/20001', |
| 2016 u'user_agent:git_cl_try'], | 2014 u'user_agent:git_cl_try'], |
| 2017 }) | 2015 }) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2215 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning') | 2213 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning') |
| 2216 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:') | 2214 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:') |
| 2217 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:') | 2215 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:') |
| 2218 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs') | 2216 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs') |
| 2219 | 2217 |
| 2220 | 2218 |
| 2221 if __name__ == '__main__': | 2219 if __name__ == '__main__': |
| 2222 git_cl.logging.basicConfig( | 2220 git_cl.logging.basicConfig( |
| 2223 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 2221 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
| 2224 unittest.main() | 2222 unittest.main() |
| OLD | NEW |