11
11
12
12
CODEOWNERS = {
13
13
"content" : """
14
+ # MARGEBOT_MINIMUM_APPROVERS = 2
14
15
# This is an example code owners file, lines starting with a `#` will
15
16
# be ignored.
16
17
24
25
# pylint: disable=anomalous-backslash-in-string
25
26
CODEOWNERS_FULL = {
26
27
"content" : """
28
+ # MARGEBOT_MINIMUM_APPROVERS=3
27
29
# This is an example code owners file, lines starting with a `#` will
28
30
# be ignored.
29
31
49
51
# owner for the LICENSE file
50
52
LICENSE @legal this_does_not_match [email protected]
51
53
52
- # Group names can be used to match groups and nested groups to specify
53
- # them as owners for a file
54
- README @group @group/with-nested/subgroup
55
-
56
54
# Ending a path in a `/` will specify the code owners for every file
57
55
# nested in that directory, on any level
58
56
/docs/ @all-docs
@@ -222,7 +220,7 @@ def test_fetch_from_merge_request_ce_compat(self):
222
220
'id' : 74 ,
223
221
'iid' : 6 ,
224
222
'project_id' : 1234 ,
225
- 'approvals_left' : 2 ,
223
+ 'approvals_left' : 1 ,
226
224
'approved_by' : [AWARDS [1 ]],
227
225
'codeowners' : {'default-codeowner' , 'ebert' , 'test-user1' },
228
226
}
@@ -280,17 +278,19 @@ def test_approvals_ce_get_codeowners_full(self):
280
278
approvals = Approvals (api , {'id' : 74 , 'iid' : 6 , 'project_id' : 1234 })
281
279
282
280
assert approvals .get_codeowners_ce () == {
283
- '#file_with_pound.rb' : {'owner-file-with-pound' },
284
- '*' : {'default-codeowner' },
285
- '*.rb' : {'ruby-owner' },
286
- '/config/' : {'config-owner' },
287
- '/docs/' : {'all-docs' },
288
- '/docs/*' : {'root-docs' },
289
- 'CODEOWNERS' : {'owners' , 'multiple' , 'code' },
290
- 'LICENSE' : {
'this_does_not_match' ,
'[email protected] ' ,
'legal' },
291
- 'README' : {'group' , 'group/with-nested/subgroup' },
292
- 'lib/' : {'lib-owner' },
293
- 'path with spaces/' : {'space-owner' }
281
+ 'approvals_required' : 3 ,
282
+ 'owners' : {
283
+ '#file_with_pound.rb' : {'owner-file-with-pound' },
284
+ '*' : {'default-codeowner' },
285
+ '*.rb' : {'ruby-owner' },
286
+ '/config/' : {'config-owner' },
287
+ '/docs/' : {'all-docs' },
288
+ '/docs/*' : {'root-docs' },
289
+ 'CODEOWNERS' : {'owners' , 'multiple' , 'code' },
290
+ 'LICENSE' : {
'this_does_not_match' ,
'[email protected] ' ,
'legal' },
291
+ 'lib/' : {'lib-owner' },
292
+ 'path with spaces/' : {'space-owner' }
293
+ }
294
294
}
295
295
296
296
def test_approvals_ce_get_codeowners_wildcard (self ):
@@ -301,7 +301,8 @@ def test_approvals_ce_get_codeowners_wildcard(self):
301
301
approvals = Approvals (api , {'id' : 74 , 'iid' : 6 , 'project_id' : 1234 })
302
302
303
303
assert approvals .get_codeowners_ce () == {
304
- '*' : set (['default-codeowner' , 'test-user1' , 'ebert' ]), 'unmatched/*' : {'test5' }
304
+ 'approvals_required' : 2 ,
305
+ 'owners' : {'*' : {'default-codeowner' , 'test-user1' , 'ebert' }, 'unmatched/*' : {'test5' }}
305
306
}
306
307
307
308
@patch ('marge.approvals.Approvals.get_awards_ce' , Mock (return_value = AWARDS ))
@@ -316,5 +317,5 @@ def test_approvals_ce(self):
316
317
317
318
result = approvals .get_approvers_ce ()
318
319
319
- assert result ['approvals_left' ] == 2
320
+ assert result ['approvals_left' ] == 1
320
321
assert len (result ['approved_by' ]) == 1
0 commit comments