-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for _matrix/client/v1/media/download (#727)
* add tests for _matrix/client/v1/media/download endpoint * requested changes * split content test into federation/local and test authentication
- Loading branch information
Showing
6 changed files
with
289 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package tests | ||
|
||
import ( | ||
"bytes" | ||
"github.com/matrix-org/complement" | ||
"github.com/matrix-org/complement/helpers" | ||
"github.com/matrix-org/complement/internal/data" | ||
"testing" | ||
) | ||
|
||
func TestContentMediaV1(t *testing.T) { | ||
deployment := complement.Deploy(t, 2) | ||
defer deployment.Destroy(t) | ||
|
||
hs1 := deployment.Register(t, "hs1", helpers.RegistrationOpts{}) | ||
hs2 := deployment.Register(t, "hs2", helpers.RegistrationOpts{}) | ||
|
||
wantContentType := "img/png" | ||
mxcUri := hs1.UploadContent(t, data.MatrixPng, "test.png", wantContentType) | ||
|
||
content, contentType := hs2.DownloadContentAuthenticated(t, mxcUri) | ||
if !bytes.Equal(data.MatrixPng, content) { | ||
t.Fatalf("uploaded and downloaded content doesn't match: want %v\ngot\n%v", data.MatrixPng, content) | ||
} | ||
if contentType != wantContentType { | ||
t.Fatalf("expected contentType to be \n %s, got \n %s", wantContentType, contentType) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.