예제 #1
0
func Test_Fetch_Failed_Bad_GOPATH(t *testing.T) {
	// given
	os.Setenv("GOPATH", "")
	mess := message.ToWork{int64(1), message.TEST, "myPkg", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	// when
	err := scm.Fetch(mess)
	// then
	assert.NotNil(t, err)
	assert.True(t, os.IsNotExist(err))
}
예제 #2
0
func Test_Fetch_successFull_When_No_Local_Repo(t *testing.T) {
	// given
	goPath := setGoPath("toto-tmp/")
	defer os.RemoveAll(goPath)
	mess := message.ToWork{int64(1), message.TEST, "myPkg", "go1.6", "https://github.com/vil-coyote-acme/toto-example.git"}
	// when
	err := scm.Fetch(mess)
	// then
	assert.Nil(t, err)
	f, errf := os.Stat(goPath + "src/example.go")
	assert.Nil(t, errf)
	assert.True(t, !f.IsDir())
}