Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5bfc06

Browse files
authored
Merge branch 'main' into feat/group-protected-branches
2 parents86727cb +af137ca commitc5bfc06

File tree

11 files changed

+137
-12
lines changed

11 files changed

+137
-12
lines changed

‎.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
TOXENV:${{ matrix.toxenv }}
8080
run:tox -- --override-ini='log_cli=True'
8181
-name:Upload codecov coverage
82-
uses:codecov/codecov-action@v5.4.0
82+
uses:codecov/codecov-action@v5.4.2
8383
with:
8484
files:./coverage.xml
8585
flags:${{ matrix.toxenv }}
@@ -102,7 +102,7 @@ jobs:
102102
TOXENV:cover
103103
run:tox
104104
-name:Upload codecov coverage
105-
uses:codecov/codecov-action@v5.4.0
105+
uses:codecov/codecov-action@v5.4.2
106106
with:
107107
files:./coverage.xml
108108
flags:unit

‎.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ repos:
5151
-id:rst-directive-colons
5252
-id:rst-inline-touching-normal
5353
-repo:https://github.com/maxbrunet/pre-commit-renovate
54-
rev:39.240.1
54+
rev:39.253.1
5555
hooks:
5656
-id:renovate-config-validator

‎docs/api-usage-graphql.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ Get the result of a query:
4949

5050
..code-block::python
5151
52-
query="""{
53-
query{
54-
currentUser {
52+
query="""
53+
{
54+
currentUser {
5555
name
56-
}
5756
}
57+
}
5858
"""
5959
6060
result= gq.execute(query)
@@ -63,12 +63,12 @@ Get the result of a query using the async client:
6363

6464
..code-block::python
6565
66-
query="""{
67-
query{
68-
currentUser {
66+
query="""
67+
{
68+
currentUser {
6969
name
70-
}
7170
}
71+
}
7272
"""
7373
7474
result=await async_gq.execute(query)

‎docs/gl_objects/groups.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ Set the avatar image for a group::
8282
group.avatar = open('path/to/file.png', 'rb')
8383
group.save()
8484

85+
Remove the avatar image for a group::
86+
87+
group.avatar = ""
88+
group.save()
89+
8590
Remove a group::
8691

8792
gl.groups.delete(group_id)

‎docs/gl_objects/projects.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ Set the avatar image for a project::
109109
project.avatar = open('path/to/file.png', 'rb')
110110
project.save()
111111

112+
Remove the avatar image for a project::
113+
114+
project.avatar = ""
115+
project.save()
116+
112117
Delete a project::
113118

114119
gl.projects.delete(project_id)

‎docs/gl_objects/topics.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,16 @@ Delete a topic::
5050
Merge a source topic into a target topic::
5151

5252
gl.topics.merge(topic_id, target_topic_id)
53+
54+
Set the avatar image for a topic::
55+
56+
# the avatar image can be passed as data (content of the file) or as a file
57+
# object opened in binary mode
58+
topic.avatar = open('path/to/file.png', 'rb')
59+
topic.save()
60+
61+
Remove the avatar image for a topic::
62+
63+
topic.avatar = ""
64+
topic.save()
65+

‎gitlab/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ def _transform_types(
188188

189189
# if the type is FileAttribute we need to pass the data as file
190190
ifisinstance(gitlab_attribute,types.FileAttribute)andtransform_files:
191+
# The GitLab API accepts mixed types
192+
# (e.g. a file for avatar image or empty string for removing the avatar)
193+
# So if string is empty, keep it in data dict
194+
ifisinstance(data[attr_name],str)anddata[attr_name]=="":
195+
continue
196+
191197
key=gitlab_attribute.get_file_name(attr_name)
192198
files[attr_name]= (key,data.pop(attr_name))
193199
continue

‎requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ pytest==8.3.5
99
PyYaml==6.0.2
1010
responses==0.25.7
1111
respx==0.22.0
12-
trio==0.29.0
12+
trio==0.30.0
1313
wheel==0.45.1

‎tests/functional/api/test_groups.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,34 @@ def test_group_labels(group):
138138
label.delete()
139139

140140

141+
deftest_group_avatar_upload(gl,group,fixture_dir):
142+
"""Test uploading an avatar to a group."""
143+
# Upload avatar
144+
withopen(fixture_dir/"avatar.png","rb")asavatar_file:
145+
group.avatar=avatar_file
146+
group.save()
147+
148+
# Verify the avatar was set
149+
updated_group=gl.groups.get(group.id)
150+
assertupdated_group.avatar_urlisnotNone
151+
152+
153+
deftest_group_avatar_remove(gl,group,fixture_dir):
154+
"""Test removing an avatar from a group."""
155+
# First set an avatar
156+
withopen(fixture_dir/"avatar.png","rb")asavatar_file:
157+
group.avatar=avatar_file
158+
group.save()
159+
160+
# Now remove the avatar
161+
group.avatar=""
162+
group.save()
163+
164+
# Verify the avatar was removed
165+
updated_group=gl.groups.get(group.id)
166+
assertupdated_group.avatar_urlisNone
167+
168+
141169
@pytest.mark.gitlab_premium
142170
@pytest.mark.xfail(reason="/ldap/groups endpoint not documented")
143171
deftest_ldap_groups(gl):

‎tests/functional/api/test_projects.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,29 @@ def test_project_members(user, project):
4848
member.delete()
4949

5050

51+
deftest_project_avatar_upload(gl,project,fixture_dir):
52+
"""Test uploading an avatar to a project."""
53+
withopen(fixture_dir/"avatar.png","rb")asavatar_file:
54+
project.avatar=avatar_file
55+
project.save()
56+
57+
updated_project=gl.projects.get(project.id)
58+
assertupdated_project.avatar_urlisnotNone
59+
60+
61+
deftest_project_avatar_remove(gl,project,fixture_dir):
62+
"""Test removing an avatar from a project."""
63+
withopen(fixture_dir/"avatar.png","rb")asavatar_file:
64+
project.avatar=avatar_file
65+
project.save()
66+
67+
project.avatar=""
68+
project.save()
69+
70+
updated_project=gl.projects.get(project.id)
71+
assertupdated_project.avatar_urlisNone
72+
73+
5174
deftest_project_badges(project):
5275
badge_image="http://example.com"
5376
badge_link="http://example/img.svg"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp