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

Side by Side Diff: commit-queue/tests/project_base_test.py

Issue 135363007: Delete public commit queue to avoid confusion after move to internal repo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « commit-queue/tests/presubmit_check_test.py ('k') | commit-queue/tests/project_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Unit tests for verification/project_base.py."""
7
8 import logging
9 import os
10 import re
11 import sys
12 import unittest
13
14 ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
15 sys.path.insert(0, os.path.join(ROOT_DIR, '..'))
16
17 import find_depot_tools # pylint: disable=W0611
18 import breakpad
19
20 # From tests/
21 import mocks
22
23 from verification import project_base
24
25
26 class ProjectBaseTest(mocks.TestCase):
27 def test_skip(self):
28 self._check(project_base.base.IGNORED, '', False)
29
30 def test_base(self):
31 self.pending.base_url = 'http://example.com/'
32 self._check(project_base.base.SUCCEEDED, '', False)
33
34 def test_relpath(self):
35 self.pending.base_url = 'http://example.com/foo/bar'
36 self._check(project_base.base.SUCCEEDED, 'foo/bar', False)
37
38 def test_base_dupe(self):
39 self.pending.base_url = 'http://example2.com/foo'
40 self._check(project_base.base.SUCCEEDED, 'foo', True)
41
42 def _check(self, state, relpath, expected_stack):
43 stack = []
44 self.mock(breakpad, 'SendStack', lambda *args: stack.append(args))
45 base = re.escape('http://example.com/')
46 base2 = re.escape('http://example2.com/')
47 ver = project_base.ProjectBaseUrlVerifier(
48 [
49 r'^%s$' % base,
50 r'^%s(.+)$' % base,
51 r'^%s(.+)$' % base2,
52 r'^%s(.+)$' % base2,
53 ])
54 ver.verify(self.pending)
55 ver.update_status([self.pending])
56 name = project_base.ProjectBaseUrlVerifier.name
57 self.assertEqual([name], self.pending.verifications.keys())
58 self.assertEqual(None, self.pending.verifications[name].error_message)
59 self.assertEqual(self.pending.verifications[name].get_state(), state)
60 self.assertEqual(relpath, self.pending.relpath)
61 if expected_stack:
62 self.assertEqual(1, len(stack))
63 self.assertEqual(2, len(stack[0]))
64 self.assertEqual(
65 ('pending.base_url triggered multiple matches',), stack[0][0].args)
66 self.assertEqual('', stack[0][1])
67 else:
68 self.assertEqual([], stack)
69
70
71 if __name__ == '__main__':
72 logging.basicConfig(level=logging.ERROR)
73 unittest.main()
OLDNEW
« no previous file with comments | « commit-queue/tests/presubmit_check_test.py ('k') | commit-queue/tests/project_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698