You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
1 year ago
|
package gallery_test
|
||
2 years ago
|
|
||
|
import (
|
||
1 year ago
|
. "github.com/go-skynet/LocalAI/pkg/gallery"
|
||
2 years ago
|
. "github.com/onsi/ginkgo/v2"
|
||
|
. "github.com/onsi/gomega"
|
||
|
)
|
||
|
|
||
1 year ago
|
type example struct {
|
||
|
Name string `yaml:"name"`
|
||
|
}
|
||
|
|
||
2 years ago
|
var _ = Describe("Gallery API tests", func() {
|
||
1 year ago
|
|
||
2 years ago
|
Context("requests", func() {
|
||
|
It("parses github with a branch", func() {
|
||
1 year ago
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml@main"}
|
||
|
var e example
|
||
|
err := req.Get(&e)
|
||
|
Expect(err).ToNot(HaveOccurred())
|
||
|
Expect(e.Name).To(Equal("gpt4all-j"))
|
||
|
})
|
||
|
It("parses github without a branch", func() {
|
||
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml@main"}
|
||
2 years ago
|
str, err := req.DecodeURL()
|
||
|
Expect(err).ToNot(HaveOccurred())
|
||
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
||
|
})
|
||
|
It("parses github without a branch", func() {
|
||
1 year ago
|
req := GalleryModel{URL: "github:go-skynet/model-gallery/gpt4all-j.yaml"}
|
||
2 years ago
|
str, err := req.DecodeURL()
|
||
|
Expect(err).ToNot(HaveOccurred())
|
||
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
||
|
})
|
||
|
It("parses URLS", func() {
|
||
1 year ago
|
req := GalleryModel{URL: "https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"}
|
||
2 years ago
|
str, err := req.DecodeURL()
|
||
|
Expect(err).ToNot(HaveOccurred())
|
||
|
Expect(str).To(Equal("https://raw.githubusercontent.com/go-skynet/model-gallery/main/gpt4all-j.yaml"))
|
||
|
})
|
||
|
})
|
||
|
})
|