|
|
@ -9,7 +9,6 @@ import (
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
@ -51,7 +50,7 @@ func TestHandler_Source(t *testing.T) {
|
|
|
|
AuthInstance: auth.HMACAuth{},
|
|
|
|
AuthInstance: auth.HMACAuth{},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
ctx := context.Background()
|
|
|
|
res, err := handler.Source(ctx, "", url.URL{}, 0, true, 0)
|
|
|
|
res, err := handler.Source(ctx, "", 0, true, 0)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.NotEmpty(res)
|
|
|
|
asserts.NotEmpty(res)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -66,7 +65,7 @@ func TestHandler_Source(t *testing.T) {
|
|
|
|
SourceName: "1.txt",
|
|
|
|
SourceName: "1.txt",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
res, err := handler.Source(ctx, "", url.URL{}, 10, true, 0)
|
|
|
|
res, err := handler.Source(ctx, "", 10, true, 0)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.Contains(res, "api/v3/slave/download/0")
|
|
|
|
asserts.Contains(res, "api/v3/slave/download/0")
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -81,7 +80,7 @@ func TestHandler_Source(t *testing.T) {
|
|
|
|
SourceName: "1.txt",
|
|
|
|
SourceName: "1.txt",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
res, err := handler.Source(ctx, "", url.URL{}, 10, true, 0)
|
|
|
|
res, err := handler.Source(ctx, "", 10, true, 0)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.Contains(res, "api/v3/slave/download/0")
|
|
|
|
asserts.Contains(res, "api/v3/slave/download/0")
|
|
|
|
asserts.Contains(res, "https://cqu.edu.cn")
|
|
|
|
asserts.Contains(res, "https://cqu.edu.cn")
|
|
|
@ -97,7 +96,7 @@ func TestHandler_Source(t *testing.T) {
|
|
|
|
SourceName: "1.txt",
|
|
|
|
SourceName: "1.txt",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
res, err := handler.Source(ctx, "", url.URL{}, 10, true, 0)
|
|
|
|
res, err := handler.Source(ctx, "", 10, true, 0)
|
|
|
|
asserts.Error(err)
|
|
|
|
asserts.Error(err)
|
|
|
|
asserts.Empty(res)
|
|
|
|
asserts.Empty(res)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -112,7 +111,7 @@ func TestHandler_Source(t *testing.T) {
|
|
|
|
SourceName: "1.txt",
|
|
|
|
SourceName: "1.txt",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
ctx := context.WithValue(context.Background(), fsctx.FileModelCtx, file)
|
|
|
|
res, err := handler.Source(ctx, "", url.URL{}, 10, false, 0)
|
|
|
|
res, err := handler.Source(ctx, "", 10, false, 0)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.NoError(err)
|
|
|
|
asserts.Contains(res, "api/v3/slave/source/0")
|
|
|
|
asserts.Contains(res, "api/v3/slave/source/0")
|
|
|
|
}
|
|
|
|
}
|
|
|
|