Skip to content

Commit 427320a

Browse files
committed
Skip more unauthed media tests on Synapse
1 parent 272068b commit 427320a

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

tests/media_filename_test.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func TestMediaFilenames(t *testing.T) {
4141
var filename = filename
4242

4343
t.Run(fmt.Sprintf("Can download file '%s'", filename), func(t *testing.T) {
44+
runtime.SkipIf(t, runtime.Synapse)
4445
t.Parallel()
4546

4647
mxcUri := alice.UploadContent(t, data.MatrixPng, filename, "image/png")
@@ -69,6 +70,7 @@ func TestMediaFilenames(t *testing.T) {
6970

7071
// sytest: Can download specifying a different ASCII file name
7172
t.Run("Can download specifying a different ASCII file name", func(t *testing.T) {
73+
runtime.SkipIf(t, runtime.Synapse)
7274
t.Parallel()
7375

7476
mxcUri := alice.UploadContent(t, data.MatrixPng, asciiFileName, "image/png")
@@ -107,6 +109,7 @@ func TestMediaFilenames(t *testing.T) {
107109

108110
// sytest: Can download specifying a different Unicode file name
109111
t.Run("Can download specifying a different Unicode file name", func(t *testing.T) {
112+
runtime.SkipIf(t, runtime.Synapse)
110113
t.Parallel()
111114

112115
mxcUri := alice.UploadContent(t, data.MatrixPng, unicodeFileName, "image/png")
@@ -136,6 +139,7 @@ func TestMediaFilenames(t *testing.T) {
136139

137140
// sytest: Can download with Unicode file name locally
138141
t.Run("Can download with Unicode file name locally", func(t *testing.T) {
142+
runtime.SkipIf(t, runtime.Synapse)
139143
t.Parallel()
140144

141145
mxcUri := alice.UploadContent(t, data.MatrixPng, unicodeFileName, "image/png")
@@ -161,6 +165,7 @@ func TestMediaFilenames(t *testing.T) {
161165

162166
// sytest: Can download with Unicode file name over federation
163167
t.Run("Can download with Unicode file name over federation", func(t *testing.T) {
168+
runtime.SkipIf(t, runtime.Synapse)
164169
t.Parallel()
165170

166171
mxcUri := alice.UploadContent(t, data.MatrixPng, unicodeFileName, "image/png")
@@ -185,11 +190,11 @@ func TestMediaFilenames(t *testing.T) {
185190
})
186191

187192
t.Run("Will serve safe media types as inline", func(t *testing.T) {
188-
if runtime.Homeserver != runtime.Synapse && runtime.Homeserver != runtime.Conduwuit {
193+
if runtime.Homeserver != runtime.Conduwuit {
189194
// We need to check that this security behaviour is being correctly run in
190-
// Synapse or conduwuit, but since this is not part of the Matrix spec we do not assume
195+
// conduwuit, but since this is not part of the Matrix spec we do not assume
191196
// other homeservers are doing so.
192-
t.Skip("Skipping test of Content-Disposition header requirements on non-Synapse and non-conduwuit homeserver")
197+
t.Skip("Skipping test of Content-Disposition header requirements on non-conduwuit homeserver")
193198
}
194199
t.Parallel()
195200

@@ -221,11 +226,11 @@ func TestMediaFilenames(t *testing.T) {
221226
})
222227

223228
t.Run("Will serve safe media types with parameters as inline", func(t *testing.T) {
224-
if runtime.Homeserver != runtime.Synapse && runtime.Homeserver != runtime.Conduwuit {
229+
if runtime.Homeserver != runtime.Conduwuit {
225230
// We need to check that this security behaviour is being correctly run in
226-
// Synapse or conduwuit, but since this is not part of the Matrix spec we do not assume
231+
// conduwuit, but since this is not part of the Matrix spec we do not assume
227232
// other homeservers are doing so.
228-
t.Skip("Skipping test of Content-Disposition header requirements on non-Synapse and non-conduwuit homeserver")
233+
t.Skip("Skipping test of Content-Disposition header requirements on non-conduwuit homeserver")
229234
}
230235
t.Parallel()
231236

@@ -259,11 +264,11 @@ func TestMediaFilenames(t *testing.T) {
259264
})
260265

261266
t.Run("Will serve unsafe media types as attachments", func(t *testing.T) {
262-
if runtime.Homeserver != runtime.Synapse && runtime.Homeserver != runtime.Conduwuit {
267+
if runtime.Homeserver != runtime.Conduwuit {
263268
// We need to check that this security behaviour is being correctly run in
264-
// Synapse or conduwuit, but since this is not part of the Matrix spec we do not assume
269+
// conduwuit, but since this is not part of the Matrix spec we do not assume
265270
// other homeservers are doing so.
266-
t.Skip("Skipping test of Content-Disposition header requirements on non-Synapse and non-conduwuit homeserver")
271+
t.Skip("Skipping test of Content-Disposition header requirements on non-conduwuit homeserver")
267272
}
268273
t.Parallel()
269274

tests/media_thumbnail_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ func TestLocalPngThumbnail(t *testing.T) {
3636

3737
uri := alice.UploadContent(t, data.LargePng, fileName, contentType)
3838

39-
fetchAndValidateThumbnail(t, alice, uri, false)
39+
t.Run("test /_matrix/media/v3 endpoint", func(t *testing.T) {
40+
runtime.SkipIf(t, runtime.Synapse)
41+
fetchAndValidateThumbnail(t, bob, uri, false)
42+
})
43+
4044
t.Run("test /_matrix/client/v1/media endpoint", func(t *testing.T) {
4145
runtime.SkipIf(t, runtime.Dendrite)
4246
fetchAndValidateThumbnail(t, alice, uri, true)
@@ -57,7 +61,10 @@ func TestRemotePngThumbnail(t *testing.T) {
5761

5862
uri := alice.UploadContent(t, data.LargePng, fileName, contentType)
5963

60-
fetchAndValidateThumbnail(t, bob, uri, false)
64+
t.Run("test /_matrix/media/v3 endpoint", func(t *testing.T) {
65+
runtime.SkipIf(t, runtime.Synapse)
66+
fetchAndValidateThumbnail(t, bob, uri, false)
67+
}
6168

6269
t.Run("test /_matrix/client/v1/media endpoint", func(t *testing.T) {
6370
runtime.SkipIf(t, runtime.Dendrite)
@@ -94,7 +101,7 @@ func TestFederationThumbnail(t *testing.T) {
94101
uri := alice.UploadContent(t, data.LargePng, fileName, contentType)
95102
mediaOrigin, mediaId := client.SplitMxc(uri)
96103

97-
path := []string{"_matrix", "media", "v3", "thumbnail", mediaOrigin, mediaId}
104+
path := []string{"_matrix", "client", "v1", "media", "thumbnail", mediaOrigin, mediaId}
98105
res := alice.MustDo(t, "GET", path, client.WithQueries(url.Values{
99106
"width": []string{"32"},
100107
"height": []string{"32"},

0 commit comments

Comments
 (0)