diff --git a/edx_repo_tools/repo_checks/repo_checks.py b/edx_repo_tools/repo_checks/repo_checks.py index 4f7afcb9..07966073 100644 --- a/edx_repo_tools/repo_checks/repo_checks.py +++ b/edx_repo_tools/repo_checks/repo_checks.py @@ -168,7 +168,7 @@ def dry_run(self): @Check.register -class EnsureRepoSettings(Check): +class Settings(Check): """ There are certain settings that we agree we want to be set a specific way on all repos. This check will ensure that those settings are set correctly on all non-security repos. @@ -257,7 +257,7 @@ def fix(self, dry_run=False): @Check.register -class EnsureNoAdminOrMaintainTeams(Check): +class NoAdminOrMaintainTeams(Check): """ Teams should not be granted `admin` or `maintain` access to a repository unless the access is exceptional and it is noted here. All other `admin` and `maintain` access is downgraded to @@ -327,7 +327,7 @@ def fix(self, dry_run=False): @Check.register -class EnsureWorkflowTemplates(Check): +class Workflows(Check): """ There are certain github action workflows that we to exist on all repos exactly as they are defined in the `.github` repo in the org. @@ -613,7 +613,7 @@ def fix(self, dry_run=False): @Check.register -class EnsureLabels(Check): +class Labels(Check): """ All repos in the org should have certain labels. """ @@ -728,12 +728,12 @@ def _simplify_label(self, label: str): return simplified_label -class RequireTeamPermission(Check): +class TeamAccess(Check): """ Require that a team has a certain level of access to a repository. To use this class as a check, create a subclass that specifies a particular - team and permission level, such as RequireTriageTeamAccess below. + team and permission level, such as TriageTeam below. """ def __init__(self, api: GhApi, org: str, repo: str, team: str, permission: str): @@ -802,7 +802,7 @@ def fix(self, dry_run=False): @Check.register -class RequireTriageTeamAccess(RequireTeamPermission): +class TriageTeam(TeamAccess): """ Ensure that the openedx-triage team grants Triage access to every public repo in the org. """ @@ -818,7 +818,7 @@ def is_relevant(self): @Check.register -class RequiredCLACheck(Check): +class EnforceCLA(Check): """ This class validates the following: @@ -838,7 +838,7 @@ def __init__(self, api, org, repo): self.cla_team = "cla-checker" self.cla_team_permission = "push" - self.team_check = RequireTeamPermission( + self.team_check = TeamAccess( api, org, repo, @@ -1079,7 +1079,7 @@ def _get_update_params_from_get_branch_protection(self): @Check.register -class EnsureNoDirectRepoAccessToUsers(Check): +class NoDirectUsers(Check): """ Users should not have direct repo access """ diff --git a/tests/test_repo_checks.py b/tests/test_repo_checks.py index 671d1d27..be1cfbb3 100644 --- a/tests/test_repo_checks.py +++ b/tests/test_repo_checks.py @@ -7,7 +7,7 @@ import pytest -from edx_repo_tools.repo_checks.repo_checks import EnsureLabels +from edx_repo_tools.repo_checks import repo_checks @pytest.fixture @@ -35,12 +35,12 @@ def maintenance_label(): ] -@patch.object(EnsureLabels, "labels", labels_yaml) -class TestEnsureLabels: +@patch.object(repo_checks.Labels, "labels", labels_yaml) +class TestLabelsCheck: def test_check_for_no_change(self, maintenance_label): api = MagicMock() api.issues.list_labels_for_repo.side_effect = [[maintenance_label], None] - check_cls = EnsureLabels(api, "test_org", "test_repo") + check_cls = repo_checks.Labels(api, "test_org", "test_repo") # Make sure that the check returns True, indicating that no changes need to be made. assert check_cls.check()[0] @@ -48,7 +48,7 @@ def test_check_for_no_change(self, maintenance_label): def test_addition(self, maintenance_label): api = MagicMock() api.issues.list_labels_for_repo.return_value = [] - check_cls = EnsureLabels(api, "test_org", "test_repo") + check_cls = repo_checks.Labels(api, "test_org", "test_repo") # The check should be false because the maintenance label should be missing. assert check_cls.check()[0] == False @@ -72,7 +72,7 @@ def test_update_label(self, maintenance_label): api = MagicMock() api.issues.list_labels_for_repo.side_effect = [[maintenance_label], None] - check_cls = EnsureLabels(api, "test_org", "test_repo") + check_cls = repo_checks.Labels(api, "test_org", "test_repo") assert check_cls.check()[0] == False check_cls.fix()