kopia lustrzana https://github.com/Langenfeld/py-gitea
removed source_id from updating users as it seems to be not necessary
rodzic
5d1ed27c88
commit
f9b35d5aa4
|
@ -140,15 +140,15 @@ class User(GiteaApiObject):
|
||||||
"must_change_password",
|
"must_change_password",
|
||||||
"password",
|
"password",
|
||||||
"prohibit_login",
|
"prohibit_login",
|
||||||
"source_id",
|
|
||||||
"website",
|
"website",
|
||||||
}
|
}
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
values = self.get_dirty_fields()
|
values = self.get_dirty_fields()
|
||||||
values.update(
|
values.update(
|
||||||
{"source_id": self.source_id, "login_name": self.username}
|
# api-doc says that the "source_id" is necessary; works without though
|
||||||
) # this request must always contain both, the user name and the _login source_ (e.g. ``None`` for local)
|
{"login_name": self.username}
|
||||||
|
)
|
||||||
args = {"username": self.username}
|
args = {"username": self.username}
|
||||||
self.gitea.requests_patch(User.ADMIN_EDIT_USER.format(**args), data=values)
|
self.gitea.requests_patch(User.ADMIN_EDIT_USER.format(**args), data=values)
|
||||||
self.dirty_fields = {}
|
self.dirty_fields = {}
|
||||||
|
|
|
@ -65,14 +65,15 @@ def test_create_user(instance):
|
||||||
|
|
||||||
def test_change_user(instance):
|
def test_change_user(instance):
|
||||||
user = instance.get_user_by_name(test_user)
|
user = instance.get_user_by_name(test_user)
|
||||||
new_website = "http://testwebsite.de"
|
location = "a house"
|
||||||
user.website = new_website
|
user.location = location
|
||||||
new_fullname = "Other Test Full Name"
|
new_fullname = "Other Test Full Name"
|
||||||
user.full_name = new_fullname
|
user.full_name = new_fullname
|
||||||
user.commit()
|
user.commit()
|
||||||
del(user)
|
del(user)
|
||||||
user = instance.get_user_by_name(test_user)
|
user = instance.get_user_by_name(test_user)
|
||||||
assert user.full_name == new_fullname
|
assert user.full_name == new_fullname
|
||||||
|
assert user.location == location
|
||||||
|
|
||||||
|
|
||||||
def test_create_org(instance):
|
def test_create_org(instance):
|
||||||
|
@ -207,8 +208,6 @@ def test_delete_org(instance):
|
||||||
Organization.request(instance, test_org)
|
Organization.request(instance, test_org)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_delete_user(instance):
|
def test_delete_user(instance):
|
||||||
user = User.request(instance, test_user)
|
user = User.request(instance, test_user)
|
||||||
user.delete()
|
user.delete()
|
||||||
|
|
Ładowanie…
Reference in New Issue