Upload slot info endpoint

This commit is contained in:
simon987
2019-03-24 18:32:29 -04:00
parent 290c67d3f6
commit 22ef1a44ad
4 changed files with 56 additions and 0 deletions

View File

@@ -97,8 +97,37 @@ func TestTokenInQueryString(t *testing.T) {
}
func TestUploadSlotInfo(t *testing.T) {
if allocateUploadSlot(api.AllocateUploadSlotRequest{
FileName: "testuploadslotinfo.png",
Token: "testuploadslotinfo",
MaxSize: 123,
}).Ok != true {
t.Error()
}
resp := getSlotInfo("testuploadslotinfo")
if resp.FileName != "testuploadslotinfo.png" {
t.Error()
}
if resp.Token != "testuploadslotinfo" {
t.Error()
}
if resp.MaxSize != 123 {
t.Error()
}
}
func allocateUploadSlot(request api.AllocateUploadSlotRequest) (ar *api.GenericResponse) {
resp := Post("/slot", request)
UnmarshalResponse(resp, &ar)
return
}
func getSlotInfo(token string) (ar *api.GetUploadSlotResponse) {
resp := Get("/slot_info", token)
UnmarshalResponse(resp, &ar)
return
}