@@ -31,3 +31,48 @@ def test_topics(gl, gitlab_version):
31
31
assert merged_topic ["id" ] == topic2 .id
32
32
33
33
topic2 .delete ()
34
+
35
+
36
+ def test_topic_avatar_upload (gl , fixture_dir ):
37
+ """Test uploading an avatar to a topic."""
38
+
39
+ topic = gl .topics .create (
40
+ {
41
+ "name" : "avatar-topic" ,
42
+ "description" : "Topic with avatar" ,
43
+ "title" : "Avatar Topic" ,
44
+ }
45
+ )
46
+
47
+ with open (fixture_dir / "avatar.png" , "rb" ) as avatar_file :
48
+ topic .avatar = avatar_file
49
+ topic .save ()
50
+
51
+ updated_topic = gl .topics .get (topic .id )
52
+ assert updated_topic .avatar_url is not None
53
+
54
+ topic .delete ()
55
+
56
+
57
+ def test_topic_avatar_remove (gl , fixture_dir ):
58
+ """Test removing an avatar from a topic."""
59
+
60
+ topic = gl .topics .create (
61
+ {
62
+ "name" : "avatar-topic-remove" ,
63
+ "description" : "Remove avatar" ,
64
+ "title" : "Remove Avatar" ,
65
+ }
66
+ )
67
+
68
+ with open (fixture_dir / "avatar.png" , "rb" ) as avatar_file :
69
+ topic .avatar = avatar_file
70
+ topic .save ()
71
+
72
+ topic .avatar = ""
73
+ topic .save ()
74
+
75
+ updated_topic = gl .topics .get (topic .id )
76
+ assert updated_topic .avatar_url is None
77
+
78
+ topic .delete ()
0 commit comments