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

Unified Diff: tests/owners_unittest.py

Issue 6677090: Fix the owners implementation to validate method inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 9 years, 9 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
« owners.py ('K') | « owners.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/owners_unittest.py
===================================================================
--- tests/owners_unittest.py (revision 78355)
+++ tests/owners_unittest.py (working copy)
@@ -98,6 +98,25 @@
self.assert_not_covered_by(['content/content.gyp'], [ben],
['content/content.gyp'])
+ def test_not_covered_by__valid_inputs(self):
+ db = self.db()
+
+ # Check that we're passed in a sequence that isn't a string.
+ self.assertRaises(AssertionError, db.files_not_covered_by, 'foo', [])
+ self.assertRaises(AssertionError, db.files_not_covered_by,
+ (f for f in ['x', 'y']), [])
+
+ # Check that the files are under the root.
+ db.root = '/checkout'
+ self.assertRaises(AssertionError, db.files_not_covered_by, ['/OWNERS'],
+ [])
+ db.root = '/'
+
+ # Check invalid email address.
+ self.assertRaises(AssertionError, db.files_not_covered_by, ['OWNERS'],
+ ['foo'])
+
+
def assert_reviewers_for(self, files, expected_reviewers):
db = self.db()
self.assertEquals(db.reviewers_for(set(files)), set(expected_reviewers))
@@ -109,6 +128,17 @@
def test_reviewers_for__set_noparent_works(self):
self.assert_reviewers_for(['content/content.gyp'], [john, darin])
+ def test_reviewers_for__valid_inputs(self):
+ db = self.db()
+
+ # Check that we're passed in a sequence that isn't a string.
+ self.assertRaises(AssertionError, db.reviewers_for, 'foo')
+ self.assertRaises(AssertionError, db.reviewers_for, (f for f in ['x', 'y']))
+
+ # Check that the files are under the root.
+ db.root = '/checkout'
+ self.assertRaises(AssertionError, db.reviewers_for, ['/OWNERS'])
+
def test_reviewers_for__wildcard_dir(self):
self.assert_reviewers_for(['DEPS'], [owners.EVERYONE])
« owners.py ('K') | « owners.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698