mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-01-15 21:39:43 -06:00
26 lines
828 B
Go
26 lines
828 B
Go
//go:build test
|
|
// +build test
|
|
|
|
package models
|
|
|
|
import (
|
|
"Gokapi/internal/test"
|
|
"testing"
|
|
)
|
|
|
|
func TestToJsonResult(t *testing.T) {
|
|
file := File{
|
|
Id: "testId",
|
|
Name: "testName",
|
|
Size: "10 B",
|
|
SHA256: "sha256",
|
|
ExpireAt: 50,
|
|
ExpireAtString: "future",
|
|
DownloadsRemaining: 1,
|
|
PasswordHash: "pwhash",
|
|
HotlinkId: "hotlinkid",
|
|
ContentType: "text/html",
|
|
}
|
|
test.IsEqualString(t, file.ToJsonResult("serverurl/"), `{"Result":"OK","FileInfo":{"Id":"testId","Name":"testName","Size":"10 B","SHA256":"sha256","ExpireAt":50,"ExpireAtString":"future","DownloadsRemaining":1,"PasswordHash":"pwhash","HotlinkId":"hotlinkid","ContentType":"text/html","AwsBucket":""},"Url":"serverurl/d?id=","HotlinkUrl":"serverurl/hotlink/"}`)
|
|
}
|