From f743b3ace146ce5da886b9eddc602ca9110552cd Mon Sep 17 00:00:00 2001 From: David Alber Date: Fri, 23 Feb 2018 01:05:02 -0800 Subject: [PATCH] Testing behavior when global config contains already-defined groups --- highfive/tests/test_newpr.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/highfive/tests/test_newpr.py b/highfive/tests/test_newpr.py index 217d284..8b4edb4 100644 --- a/highfive/tests/test_newpr.py +++ b/highfive/tests/test_newpr.py @@ -49,7 +49,10 @@ def setUpClass(cls): "groups": { "core": ["@alexcrichton"], } - } + }, + 'has_all': { + "groups": { "all": ["@alexcrichton"] } + }, } def choose_reviewer( @@ -165,6 +168,18 @@ def test_global_core(self): self.assertEqual(set(['alexcrichton']), chosen_reviewers) self.assertEqual(set([()]), mentions) + @mock.patch('highfive.newpr._load_json_file') + def test_global_group_overlap(self, mock_load_json): + """Test for an AssertionError when the global config contains a group + already defined in the config. + """ + mock_load_json.return_value = self.global_['has_all'] + self.assertRaises( + AssertionError, newpr.choose_reviewer, 'rust', 'rust-lang', + self.diff['normal'], 'fooauthor', + self.config['individuals_no_dirs'] + ) + def test_no_potential_reviewers(self): """Test choosing a reviewer when nobody qualifies. """