mirror of
https://github.com/gomods/athens
synced 2026-02-10 05:18:12 +00:00
* replace fs operations with afero * fix goget test * fix test * fix test again... * remove empty lines * fix merge setupTmp - return 3, not 2 values * just to start new travis build got The command "go get github.com/golang/lint/golint" failed and exited with 1 during . I hope it was a temp problem.
51 lines
813 B
Go
51 lines
813 B
Go
package github
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/spf13/afero"
|
|
)
|
|
|
|
func Test_Download(t *testing.T) {
|
|
owner := "bketelsen"
|
|
repo := "captainhook"
|
|
version := "v0.1.8"
|
|
|
|
memFs := afero.NewMemMapFs()
|
|
|
|
fetcher, err := NewGitFetcher(memFs, owner, repo, version)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
path, err := fetcher.Fetch()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
if path == "" {
|
|
t.Error("path null")
|
|
}
|
|
|
|
t.Log(path)
|
|
if _, err := memFs.Stat(filepath.Join(path, version+".mod")); err != nil {
|
|
t.Error(err)
|
|
t.Fail()
|
|
}
|
|
|
|
if _, err := memFs.Stat(filepath.Join(path, version+".zip")); err != nil {
|
|
t.Error(err)
|
|
t.Fail()
|
|
}
|
|
|
|
if _, err := memFs.Stat(filepath.Join(path, version+".info")); err != nil {
|
|
t.Error(err)
|
|
t.Fail()
|
|
}
|
|
|
|
err = fetcher.Clear()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|