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 owners.py.""" | 6 """Unit tests for owners.py.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import unittest | 10 import unittest |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 []) | 147 []) |
148 | 148 |
149 # tom is allowed to approve ugly.cc, but not froboz.h | 149 # tom is allowed to approve ugly.cc, but not froboz.h |
150 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], | 150 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], |
151 [tom], | 151 [tom], |
152 []) | 152 []) |
153 self.assert_dirs_not_covered_by(['content/baz/froboz.h'], | 153 self.assert_dirs_not_covered_by(['content/baz/froboz.h'], |
154 [tom], | 154 [tom], |
155 ['content/baz']) | 155 ['content/baz']) |
156 | 156 |
| 157 def test_per_file_with_spaces(self): |
| 158 # This is the same as test_per_file(), except that we include spaces |
| 159 # on the per-file line. brett isn't allowed to approve ugly.cc; |
| 160 # tom is allowed to approve ugly.cc, but not froboz.h |
| 161 self.files['/content/baz/OWNERS'] = owners_file(brett, |
| 162 lines=['per-file ugly.* = tom@example.com']) |
| 163 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], |
| 164 [brett], |
| 165 []) |
| 166 |
| 167 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], |
| 168 [tom], |
| 169 []) |
| 170 self.assert_dirs_not_covered_by(['content/baz/froboz.h'], |
| 171 [tom], |
| 172 ['content/baz']) |
| 173 |
157 def test_per_file__set_noparent(self): | 174 def test_per_file__set_noparent(self): |
158 self.files['/content/baz/OWNERS'] = owners_file(brett, | 175 self.files['/content/baz/OWNERS'] = owners_file(brett, |
159 lines=['per-file ugly.*=tom@example.com', | 176 lines=['per-file ugly.*=tom@example.com', |
160 'per-file ugly.*=set noparent']) | 177 'per-file ugly.*=set noparent']) |
161 | 178 |
162 # brett isn't allowed to approve ugly.cc | 179 # brett isn't allowed to approve ugly.cc |
163 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], | 180 self.assert_dirs_not_covered_by(['content/baz/ugly.cc'], |
164 [brett], | 181 [brett], |
165 ['content/baz/ugly.cc']) | 182 ['content/baz/ugly.cc']) |
166 | 183 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 271 |
255 def test_syntax_error__unknown_set(self): | 272 def test_syntax_error__unknown_set(self): |
256 self.assert_syntax_error('set myfatherisbillgates\n') | 273 self.assert_syntax_error('set myfatherisbillgates\n') |
257 | 274 |
258 def test_syntax_error__bad_email(self): | 275 def test_syntax_error__bad_email(self): |
259 self.assert_syntax_error('ben\n') | 276 self.assert_syntax_error('ben\n') |
260 | 277 |
261 | 278 |
262 if __name__ == '__main__': | 279 if __name__ == '__main__': |
263 unittest.main() | 280 unittest.main() |
OLD | NEW |