2017-02-08 06:01:29 +00:00
|
|
|
package github
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io/ioutil"
|
|
|
|
"testing"
|
|
|
|
|
2018-01-19 18:56:55 +00:00
|
|
|
st "github.com/golang-migrate/migrate/source/testing"
|
2017-02-08 06:01:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var GithubTestSecret = "" // username:token
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
secrets, err := ioutil.ReadFile(".github_test_secrets")
|
|
|
|
if err == nil {
|
|
|
|
GithubTestSecret = string(bytes.TrimSpace(secrets)[:])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test(t *testing.T) {
|
2017-02-08 09:49:57 +00:00
|
|
|
if len(GithubTestSecret) == 0 {
|
|
|
|
t.Skip("test requires .github_test_secrets")
|
|
|
|
}
|
|
|
|
|
2017-02-08 06:01:29 +00:00
|
|
|
g := &Github{}
|
2018-05-04 03:06:42 +00:00
|
|
|
d, err := g.Open("github://" + GithubTestSecret + "@mattes/migrate_test_tmp/test#452b8003e7")
|
2017-02-08 06:01:29 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
st.Test(t, d)
|
|
|
|
}
|