github.com/dannyzhou2015/migrate/v4@v4.15.2/source/bitbucket/bitbucket_test.go (about)

     1  package bitbucket
     2  
     3  import (
     4  	"bytes"
     5  	"io/ioutil"
     6  	"testing"
     7  
     8  	st "github.com/dannyzhou2015/migrate/v4/source/testing"
     9  )
    10  
    11  var BitbucketTestSecret = "" // username:password
    12  
    13  func init() {
    14  	secrets, err := ioutil.ReadFile(".bitbucket_test_secrets")
    15  	if err == nil {
    16  		BitbucketTestSecret = string(bytes.TrimSpace(secrets)[:])
    17  	}
    18  }
    19  
    20  func Test(t *testing.T) {
    21  	if len(BitbucketTestSecret) == 0 {
    22  		t.Skip("test requires .bitbucket_test_secrets")
    23  	}
    24  
    25  	b := &Bitbucket{}
    26  
    27  	d, err := b.Open("bitbucket://" + BitbucketTestSecret + "@abhishekbipp/test-migration/migrations/test#master")
    28  	if err != nil {
    29  		t.Fatal(err)
    30  	}
    31  
    32  	st.Test(t, d)
    33  }