| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f4f7d7a commit 8c1aaa3
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ References | |||
| 11 | 11 | ||
| 12 | 12 | + :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRule` | |
| 13 | 13 | + :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRuleManager` | |
| 14 | - + :attr:`gitlab.v4.objects.Project.registry_repository_protection_rules` | ||
| 14 | + + :attr:`gitlab.v4.objects.Project.registry_protection_repository_rules` | ||
| 15 | 15 | ||
| 16 | 16 | * GitLab API: https://docs.gitlab.com/ee/api/container_repository_protection_rules.html | |
| 17 | 17 | ||
@@ -20,11 +20,11 @@ Examples | |||
| 20 | 20 | ||
| 21 | 21 | List the container registry protection rules for a project:: | |
| 22 | 22 | ||
| 23 | - registry_rules = project.registry_repository_protection_rules.list() | ||
| 23 | + registry_rules = project.registry_protection_repository_rules.list() | ||
| 24 | 24 | ||
| 25 | 25 | Create a container registry protection rule:: | |
| 26 | 26 | ||
| 27 | - registry_rule = project.registry_repository_protection_rules.create( | ||
| 27 | + registry_rule = project.registry_protection_repository_rules.create( | ||
| 28 | 28 | { | |
| 29 | 29 | 'repository_path_pattern': 'test/image', | |
| 30 | 30 | 'minimum_access_level_for_push': 'maintainer', | |
@@ -39,6 +39,6 @@ Update a container registry protection rule:: | |||
| 39 | 39 | ||
| 40 | 40 | Delete a container registry protection rule:: | |
| 41 | 41 | ||
| 42 | - registry_rule = project.registry_repository_protection_rules.delete(registry_rule.id) | ||
| 42 | + registry_rule = project.registry_protection_repository_rules.delete(registry_rule.id) | ||
| 43 | 43 | # or | |
| 44 | 44 | registry_rule.delete() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,8 +55,8 @@ | |||
| 55 | 55 | from .project_access_tokens import * | |
| 56 | 56 | from .projects import * | |
| 57 | 57 | from .push_rules import * | |
| 58 | + from .registry_protection_repository_rules import * | ||
| 58 | 59 | from .registry_protection_rules import * | |
| 59 | - from .registry_repository_protection_rules import * | ||
| 60 | 60 | from .releases import * | |
| 61 | 61 | from .repositories import * | |
| 62 | 62 | from .resource_groups import * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,12 +86,12 @@ | |||
| 86 | 86 | ) | |
| 87 | 87 | from .project_access_tokens import ProjectAccessTokenManager # noqa: F401 | |
| 88 | 88 | from .push_rules import ProjectPushRulesManager # noqa: F401 | |
| 89 | + from .registry_protection_repository_rules import ( # noqa: F401 | ||
| 90 | + ProjectRegistryRepositoryProtectionRuleManager, | ||
| 91 | + ) | ||
| 89 | 92 | from .registry_protection_rules import ( # noqa: F401; deprecated | |
| 90 | 93 | ProjectRegistryProtectionRuleManager, | |
| 91 | 94 | ) | |
| 92 | - from .registry_repository_protection_rules import ( # noqa: F401 | ||
| 93 | - ProjectRegistryRepositoryProtectionRuleManager, | ||
| 94 | - ) | ||
| 95 | 95 | from .releases import ProjectReleaseManager # noqa: F401 | |
| 96 | 96 | from .repositories import RepositoryMixin | |
| 97 | 97 | from .resource_groups import ProjectResourceGroupManager | |
@@ -242,7 +242,7 @@ class Project( | |||
| 242 | 242 | protectedtags: ProjectProtectedTagManager | |
| 243 | 243 | pushrules: ProjectPushRulesManager | |
| 244 | 244 | registry_protection_rules: ProjectRegistryProtectionRuleManager | |
| 245 | - registry_repository_protection_rules: ProjectRegistryRepositoryProtectionRuleManager | ||
| 245 | + registry_protection_repository_rules: ProjectRegistryRepositoryProtectionRuleManager | ||
| 246 | 246 | releases: ProjectReleaseManager | |
| 247 | 247 | resource_groups: ProjectResourceGroupManager | |
| 248 | 248 | remote_mirrors: "ProjectRemoteMirrorManager" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ class ProjectRegistryRepositoryProtectionRule(SaveMixin, RESTObject): | |||
| 15 | 15 | class ProjectRegistryRepositoryProtectionRuleManager( | |
| 16 | 16 | ListMixin, CreateMixin, UpdateMixin, RESTManager | |
| 17 | 17 | ): | |
| 18 | - _path = "/projects/{project_id}/registry/repository/protection/rules" | ||
| 18 | + _path = "/projects/{project_id}/registry/protection/repository/rules" | ||
| 19 | 19 | _obj_cls = ProjectRegistryRepositoryProtectionRule | |
| 20 | 20 | _from_parent_attrs = {"project_id": "id"} | |
| 21 | 21 | _create_attrs = RequiredOptional( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,10 +11,10 @@ def protected_registry_feature(gl: Gitlab): | |||
| 11 | 11 | ||
| 12 | 12 | @pytest.mark.skip(reason="Not released yet") | |
| 13 | 13 | def test_project_protected_registry(project: Project): | |
| 14 | - rules = project.registry_repository_protection_rules.list() | ||
| 14 | + rules = project.registry_protection_repository_rules.list() | ||
| 15 | 15 | assert isinstance(rules, list) | |
| 16 | 16 | ||
| 17 | - protected_registry = project.registry_repository_protection_rules.create( | ||
| 17 | + protected_registry = project.registry_protection_repository_rules.create( | ||
| 18 | 18 | { | |
| 19 | 19 | "repository_path_pattern": "test/image", | |
| 20 | 20 | "minimum_access_level_for_push": "maintainer", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ def resp_list_protected_registries(): | |||
| 21 | 21 | with responses.RequestsMock() as rsps: | |
| 22 | 22 | rsps.add( | |
| 23 | 23 | method=responses.GET, | |
| 24 | - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules", | ||
| 24 | + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules", | ||
| 25 | 25 | json=[protected_registry_content], | |
| 26 | 26 | content_type="application/json", | |
| 27 | 27 | status=200, | |
@@ -34,7 +34,7 @@ def resp_create_protected_registry(): | |||
| 34 | 34 | with responses.RequestsMock() as rsps: | |
| 35 | 35 | rsps.add( | |
| 36 | 36 | method=responses.POST, | |
| 37 | - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules", | ||
| 37 | + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules", | ||
| 38 | 38 | json=protected_registry_content, | |
| 39 | 39 | content_type="application/json", | |
| 40 | 40 | status=201, | |
@@ -50,7 +50,7 @@ def resp_update_protected_registry(): | |||
| 50 | 50 | with responses.RequestsMock() as rsps: | |
| 51 | 51 | rsps.add( | |
| 52 | 52 | method=responses.PATCH, | |
| 53 | - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules/1", | ||
| 53 | + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules/1", | ||
| 54 | 54 | json=updated_content, | |
| 55 | 55 | content_type="application/json", | |
| 56 | 56 | status=200, | |
@@ -59,13 +59,13 @@ def resp_update_protected_registry(): | |||
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | 61 | def test_list_project_protected_registries(project, resp_list_protected_registries): | |
| 62 | - protected_registry = project.registry_repository_protection_rules.list()[0] | ||
| 62 | + protected_registry = project.registry_protection_repository_rules.list()[0] | ||
| 63 | 63 | assert isinstance(protected_registry, ProjectRegistryRepositoryProtectionRule) | |
| 64 | 64 | assert protected_registry.repository_path_pattern == "test/image" | |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | 67 | def test_create_project_protected_registry(project, resp_create_protected_registry): | |
| 68 | - protected_registry = project.registry_repository_protection_rules.create( | ||
| 68 | + protected_registry = project.registry_protection_repository_rules.create( | ||
| 69 | 69 | { | |
| 70 | 70 | "repository_path_pattern": "test/image", | |
| 71 | 71 | "minimum_access_level_for_push": "maintainer", | |
@@ -76,7 +76,7 @@ def test_create_project_protected_registry(project, resp_create_protected_regist | |||
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | 78 | def test_update_project_protected_registry(project, resp_update_protected_registry): | |
| 79 | - updated = project.registry_repository_protection_rules.update( | ||
| 79 | + updated = project.registry_protection_repository_rules.update( | ||
| 80 | 80 | 1, {"repository_path_pattern": "abc*"} | |
| 81 | 81 | ) | |
| 82 | 82 | assert updated["repository_path_pattern"] == "abc*" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments