From f9b35d5aa458963ddca1e595b44740b3f092f533 Mon Sep 17 00:00:00 2001 From: Langenfeld Date: Tue, 19 Oct 2021 09:54:26 +0200 Subject: [PATCH] removed source_id from updating users as it seems to be not necessary --- gitea/gitea.py | 6 +++--- tests/test_api.py | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gitea/gitea.py b/gitea/gitea.py index 39ce3a9..44aaaf5 100644 --- a/gitea/gitea.py +++ b/gitea/gitea.py @@ -140,15 +140,15 @@ class User(GiteaApiObject): "must_change_password", "password", "prohibit_login", - "source_id", "website", } def commit(self): values = self.get_dirty_fields() values.update( - {"source_id": self.source_id, "login_name": self.username} - ) # this request must always contain both, the user name and the _login source_ (e.g. ``None`` for local) + # api-doc says that the "source_id" is necessary; works without though + {"login_name": self.username} + ) args = {"username": self.username} self.gitea.requests_patch(User.ADMIN_EDIT_USER.format(**args), data=values) self.dirty_fields = {} diff --git a/tests/test_api.py b/tests/test_api.py index 04cfe06..d4b2d21 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -65,14 +65,15 @@ def test_create_user(instance): def test_change_user(instance): user = instance.get_user_by_name(test_user) - new_website = "http://testwebsite.de" - user.website = new_website + location = "a house" + user.location = location new_fullname = "Other Test Full Name" user.full_name = new_fullname user.commit() del(user) user = instance.get_user_by_name(test_user) assert user.full_name == new_fullname + assert user.location == location def test_create_org(instance): @@ -207,8 +208,6 @@ def test_delete_org(instance): Organization.request(instance, test_org) - - def test_delete_user(instance): user = User.request(instance, test_user) user.delete()