Skip to content

Commit

Permalink
verify we we actually got an image
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Aug 22, 2024
1 parent c8b0fcf commit a1d9f3d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/media_thumbnail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func TestFederationThumbnail(t *testing.T) {
t.Fatalf("failed to parse multipart response: %s", err)
}

foundImage := false
reader := multipart.NewReader(resp.Body, params["boundary"])
for {
p, err := reader.NextPart()
Expand All @@ -151,8 +152,12 @@ func TestFederationThumbnail(t *testing.T) {
if !bytes.Equal(imageBody, body) {
t.Fatalf("body does not match uploaded file")
}
foundImage = true
}
}
if !foundImage {
t.Fatalf("No image was found in response.")
}
}

func fetchAndValidateThumbnail(t *testing.T, c *client.CSAPI, mxcUri string, authenticated bool) {
Expand Down

0 comments on commit a1d9f3d

Please sign in to comment.