-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
CODEOWNERS = { | ||
"content": """ | ||
# MARGEBOT_MINIMUM_APPROVERS = 2 | ||
# This is an example code owners file, lines starting with a `#` will | ||
# be ignored. | ||
|
@@ -24,6 +25,7 @@ | |
# pylint: disable=anomalous-backslash-in-string | ||
CODEOWNERS_FULL = { | ||
"content": """ | ||
# MARGEBOT_MINIMUM_APPROVERS=3 | ||
# This is an example code owners file, lines starting with a `#` will | ||
# be ignored. | ||
|
@@ -49,10 +51,6 @@ | |
# owner for the LICENSE file | ||
LICENSE @legal this_does_not_match [email protected] | ||
# Group names can be used to match groups and nested groups to specify | ||
# them as owners for a file | ||
README @group @group/with-nested/subgroup | ||
# Ending a path in a `/` will specify the code owners for every file | ||
# nested in that directory, on any level | ||
/docs/ @all-docs | ||
|
@@ -222,7 +220,7 @@ def test_fetch_from_merge_request_ce_compat(self): | |
'id': 74, | ||
'iid': 6, | ||
'project_id': 1234, | ||
'approvals_left': 2, | ||
'approvals_left': 1, | ||
'approved_by': [AWARDS[1]], | ||
'codeowners': {'default-codeowner', 'ebert', 'test-user1'}, | ||
} | ||
|
@@ -280,17 +278,20 @@ def test_approvals_ce_get_codeowners_full(self): | |
approvals = Approvals(api, {'id': 74, 'iid': 6, 'project_id': 1234}) | ||
|
||
assert approvals.get_codeowners_ce() == { | ||
'#file_with_pound.rb': {'owner-file-with-pound'}, | ||
'*': {'default-codeowner'}, | ||
'*.rb': {'ruby-owner'}, | ||
'/config/': {'config-owner'}, | ||
'/docs/': {'all-docs'}, | ||
'/docs/*': {'root-docs'}, | ||
'CODEOWNERS': {'owners', 'multiple', 'code'}, | ||
'LICENSE': {'this_does_not_match', '[email protected]', 'legal'}, | ||
'README': {'group', 'group/with-nested/subgroup'}, | ||
'lib/': {'lib-owner'}, | ||
'path with spaces/': {'space-owner'} | ||
'approvals_required': 3, | ||
'owners': { | ||
'#file_with_pound.rb': {'owner-file-with-pound'}, | ||
'*': {'default-codeowner'}, | ||
'*.rb': {'ruby-owner'}, | ||
'/config/': {'config-owner'}, | ||
'/docs/': {'all-docs'}, | ||
'/docs/*': {'root-docs'}, | ||
'CODEOWNERS': {'owners', 'multiple', 'code'}, | ||
'LICENSE': {'this_does_not_match', '[email protected]', 'legal'}, | ||
'README': {'group', 'group/with-nested/subgroup'}, | ||
'lib/': {'lib-owner'}, | ||
'path with spaces/': {'space-owner'} | ||
} | ||
} | ||
|
||
def test_approvals_ce_get_codeowners_wildcard(self): | ||
|
@@ -301,7 +302,8 @@ def test_approvals_ce_get_codeowners_wildcard(self): | |
approvals = Approvals(api, {'id': 74, 'iid': 6, 'project_id': 1234}) | ||
|
||
assert approvals.get_codeowners_ce() == { | ||
'*': set(['default-codeowner', 'test-user1', 'ebert']), 'unmatched/*': {'test5'} | ||
'approvals_required': 2, | ||
'owners': {'*': {'default-codeowner', 'test-user1', 'ebert'}, 'unmatched/*': {'test5'}} | ||
} | ||
|
||
@patch('marge.approvals.Approvals.get_awards_ce', Mock(return_value=AWARDS)) | ||
|
@@ -316,5 +318,5 @@ def test_approvals_ce(self): | |
|
||
result = approvals.get_approvers_ce() | ||
|
||
assert result['approvals_left'] == 2 | ||
assert result['approvals_left'] == 1 | ||
assert len(result['approved_by']) == 1 |