kopia lustrzana https://github.com/Langenfeld/py-gitea
Merge pull request #20 from oyvindkolbu/update-repository-patch-fields
Update repository patch fields as of Gitea 1.18.1pull/22/head
commit
71d543bbfc
|
@ -357,22 +357,40 @@ class Repository(ApiObject):
|
||||||
return cls._request(gitea, {"owner": owner, "name": name})
|
return cls._request(gitea, {"owner": owner, "name": name})
|
||||||
|
|
||||||
_patchable_fields = {
|
_patchable_fields = {
|
||||||
|
"allow_manual_merge",
|
||||||
"allow_merge_commits",
|
"allow_merge_commits",
|
||||||
"allow_rebase",
|
"allow_rebase",
|
||||||
"allow_rebase_explicit",
|
"allow_rebase_explicit",
|
||||||
|
"allow_rebase_update",
|
||||||
"allow_squash_merge",
|
"allow_squash_merge",
|
||||||
"archived",
|
"archived",
|
||||||
|
"autodetect_manual_merge",
|
||||||
"default_branch",
|
"default_branch",
|
||||||
|
"default_delete_branch_after_merge",
|
||||||
|
"default_merge_style",
|
||||||
"description",
|
"description",
|
||||||
|
"enable_prune",
|
||||||
|
"external_tracker",
|
||||||
|
"external_wiki",
|
||||||
"has_issues",
|
"has_issues",
|
||||||
|
"has_projects",
|
||||||
"has_pull_requests",
|
"has_pull_requests",
|
||||||
"has_wiki",
|
"has_wiki",
|
||||||
"ignore_whitespace_conflicts",
|
"ignore_whitespace_conflicts",
|
||||||
|
"internal_tracker",
|
||||||
|
"mirror_interval",
|
||||||
"name",
|
"name",
|
||||||
"private",
|
"private",
|
||||||
|
"template",
|
||||||
"website",
|
"website",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def commit(self):
|
||||||
|
values = self.get_dirty_fields()
|
||||||
|
args = {"owner": self.owner.username, "name": self.name}
|
||||||
|
self.gitea.requests_patch(self.API_OBJECT.format(**args), data=values)
|
||||||
|
self.dirty_fields = {}
|
||||||
|
|
||||||
def get_branches(self) -> List['Branch']:
|
def get_branches(self) -> List['Branch']:
|
||||||
"""Get all the Branches of this Repository."""
|
"""Get all the Branches of this Repository."""
|
||||||
results = self.gitea.requests_get(
|
results = self.gitea.requests_get(
|
||||||
|
|
|
@ -127,6 +127,24 @@ def test_create_repo_orgowned(instance):
|
||||||
assert repo.name == test_repo
|
assert repo.name == test_repo
|
||||||
assert not repo.private
|
assert not repo.private
|
||||||
|
|
||||||
|
|
||||||
|
def test_patch_repo(instance):
|
||||||
|
fields = {
|
||||||
|
"allow_rebase": False,
|
||||||
|
"description": "new description",
|
||||||
|
"has_projects": True,
|
||||||
|
"private": True,
|
||||||
|
}
|
||||||
|
org = Organization.request(instance, test_org)
|
||||||
|
repo = org.get_repository(test_repo)
|
||||||
|
for field, value in fields.items():
|
||||||
|
setattr(repo, field, value)
|
||||||
|
repo.commit()
|
||||||
|
repo = org.get_repository(test_repo)
|
||||||
|
for field, value in fields.items():
|
||||||
|
assert getattr(repo, field) == value
|
||||||
|
|
||||||
|
|
||||||
def test_list_branches(instance):
|
def test_list_branches(instance):
|
||||||
org = Organization.request(instance, test_org)
|
org = Organization.request(instance, test_org)
|
||||||
repo = org.get_repository(test_repo)
|
repo = org.get_repository(test_repo)
|
||||||
|
|
Ładowanie…
Reference in New Issue