Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gitlab/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def _get_updated_data(self) -> Dict[str, Any]:

return updated_data

def save(self, **kwargs: Any) -> None:
def save(self, **kwargs: Any) -> Optional[Dict[str, Any]]:
"""Save the changes made to the object to the server.

The object is updated to match what the server returns.
Expand All @@ -542,15 +542,18 @@ def save(self, **kwargs: Any) -> None:
updated_data = self._get_updated_data()
# Nothing to update. Server fails if sent an empty dict.
if not updated_data:
return
return None

# call the manager
obj_id = self.get_id()
if TYPE_CHECKING:
assert isinstance(self.manager, UpdateMixin)
if isinstance(obj_id, str):
obj_id = utils._url_encode(obj_id)
server_data = self.manager.update(obj_id, updated_data, **kwargs)
if server_data is not None:
self._update_attrs(server_data)
return server_data


class ObjectDeleteMixin(_RestObjectBase):
Expand Down
15 changes: 15 additions & 0 deletions tests/functional/api/test_wikis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
GitLab API:
https://docs.gitlab.com/ee/api/wikis.html
"""


def test_wikis(project):

page = project.wikis.create({"title": "title/subtitle", "content": "test content"})
page.content = "update content"
page.title = "subtitle"

page.save()

page.delete()