2023-05-15 07:29:40 +00:00
|
|
|
package metasnap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/davecgh/go-spew/spew"
|
|
|
|
)
|
|
|
|
|
2023-05-15 07:41:44 +00:00
|
|
|
func TestGetRepo(t *testing.T) {
|
2023-05-15 07:29:40 +00:00
|
|
|
// existing
|
2023-05-15 07:41:44 +00:00
|
|
|
infos, err := GetRepo("debian", "linux-image-3.8-trunk-amd64",
|
2023-05-15 07:29:40 +00:00
|
|
|
"amd64", "3.8.2-1~experimental.1")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
t.Log(spew.Sdump(infos))
|
|
|
|
|
|
|
|
// non-existing
|
2023-05-15 07:41:44 +00:00
|
|
|
infos, err = GetRepo("debian", "meh", "amd64", "meh")
|
2023-05-15 07:29:40 +00:00
|
|
|
if err == nil {
|
|
|
|
t.Fatalf("should not be ok, result: %s", spew.Sdump(infos))
|
|
|
|
}
|
|
|
|
|
|
|
|
if err != ErrNotFound {
|
|
|
|
t.Fatal("wrong error type")
|
|
|
|
}
|
|
|
|
}
|