github.com/dhui/migrate@v3.4.0+incompatible/source/github/github_test.go (about)

     1  package github
     2  
     3  import (
     4  	"bytes"
     5  	"io/ioutil"
     6  	"testing"
     7  
     8  	st "github.com/golang-migrate/migrate/source/testing"
     9  )
    10  
    11  var GithubTestSecret = "" // username:token
    12  
    13  func init() {
    14  	secrets, err := ioutil.ReadFile(".github_test_secrets")
    15  	if err == nil {
    16  		GithubTestSecret = string(bytes.TrimSpace(secrets)[:])
    17  	}
    18  }
    19  
    20  func Test(t *testing.T) {
    21  	if len(GithubTestSecret) == 0 {
    22  		t.Skip("test requires .github_test_secrets")
    23  	}
    24  
    25  	g := &Github{}
    26  	d, err := g.Open("github://" + GithubTestSecret + "@mattes/migrate_test_tmp/test#452b8003e7")
    27  	if err != nil {
    28  		t.Fatal(err)
    29  	}
    30  
    31  	st.Test(t, d)
    32  }