mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-13 18:03:10 -06:00
cmd/mediaapi-integration-tests: Simplify getMediaURL argument
This commit is contained in:
parent
82f9ac5cc9
commit
83e54d9d74
|
|
@ -136,12 +136,12 @@ func main() {
|
||||||
// create server1 with only pre-generated thumbnails allowed
|
// create server1 with only pre-generated thumbnails allowed
|
||||||
server1Cmd, server1CmdChan, server1Dir := startMediaAPI("1", false)
|
server1Cmd, server1CmdChan, server1Dir := startMediaAPI("1", false)
|
||||||
defer cleanUpServer(server1Cmd, server1Dir)
|
defer cleanUpServer(server1Cmd, server1Dir)
|
||||||
testDownload("1", "localhost:17771", "doesnotexist", "", 404, server1CmdChan)
|
testDownload("localhost:17771", "localhost:17771", "doesnotexist", "", 404, server1CmdChan)
|
||||||
|
|
||||||
// create server2 with dynamic thumbnail generation
|
// create server2 with dynamic thumbnail generation
|
||||||
server2Cmd, server2CmdChan, server2Dir := startMediaAPI("2", true)
|
server2Cmd, server2CmdChan, server2Dir := startMediaAPI("2", true)
|
||||||
defer cleanUpServer(server2Cmd, server2Dir)
|
defer cleanUpServer(server2Cmd, server2Dir)
|
||||||
testDownload("2", "localhost:17772", "doesnotexist", "", 404, server2CmdChan)
|
testDownload("localhost:17772", "localhost:17772", "doesnotexist", "", 404, server2CmdChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMediaURI(scheme, host, endpoint string, components []string) string {
|
func getMediaURI(scheme, host, endpoint string, components []string) string {
|
||||||
|
|
@ -150,10 +150,10 @@ func getMediaURI(scheme, host, endpoint string, components []string) string {
|
||||||
return scheme + path.Join(pathComponents...)
|
return scheme + path.Join(pathComponents...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDownload(suffix, origin, mediaID, wantedBody string, wantedStatusCode int, serverCmdChan chan error) {
|
func testDownload(host, origin, mediaID, wantedBody string, wantedStatusCode int, serverCmdChan chan error) {
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
"GET",
|
"GET",
|
||||||
getMediaURI("http://", "localhost:1777"+suffix, "download", []string{
|
getMediaURI("http://", host, "download", []string{
|
||||||
origin,
|
origin,
|
||||||
mediaID,
|
mediaID,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue