2024-01-05 22:16:33 +00:00
|
|
|
package downloader_test
|
2023-06-26 10:25:38 +00:00
|
|
|
|
|
|
|
import (
|
2024-06-23 08:24:36 +00:00
|
|
|
. "github.com/mudler/LocalAI/pkg/downloader"
|
2023-06-26 10:25:38 +00:00
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = Describe("Gallery API tests", func() {
|
|
|
|
Context("URI", func() {
|
|
|
|
It("parses github with a branch", func() {
|
2024-08-02 18:06:25 +00:00
|
|
|
uri := URI("github:go-skynet/model-gallery/gpt4all-j.yaml")
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(
|
2024-09-24 07:32:48 +00:00
|
|
|
uri.DownloadWithCallback("", func(url string, i []byte) error {
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(url).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
return nil
|
|
|
|
}),
|
|
|
|
).ToNot(HaveOccurred())
|
|
|
|
})
|
|
|
|
It("parses github without a branch", func() {
|
2024-08-02 18:06:25 +00:00
|
|
|
uri := URI("github:go-skynet/model-gallery/gpt4all-j.yaml@main")
|
|
|
|
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(
|
2024-09-24 07:32:48 +00:00
|
|
|
uri.DownloadWithCallback("", func(url string, i []byte) error {
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(url).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
return nil
|
|
|
|
}),
|
|
|
|
).ToNot(HaveOccurred())
|
|
|
|
})
|
|
|
|
It("parses github with urls", func() {
|
2024-08-02 18:06:25 +00:00
|
|
|
uri := URI("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml")
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(
|
2024-09-24 07:32:48 +00:00
|
|
|
uri.DownloadWithCallback("", func(url string, i []byte) error {
|
2023-06-26 10:25:38 +00:00
|
|
|
Expect(url).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
|
|
|
return nil
|
|
|
|
}),
|
|
|
|
).ToNot(HaveOccurred())
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|