github.com/echohead/hub@v2.2.1+incompatible/github/localrepo_test.go (about) 1 package github 2 3 import ( 4 "net/url" 5 "testing" 6 7 "github.com/github/hub/Godeps/_workspace/src/github.com/bmizerany/assert" 8 "github.com/github/hub/fixtures" 9 ) 10 11 func TestGitHubRepo_OriginRemote(t *testing.T) { 12 repo := fixtures.SetupTestRepo() 13 defer repo.TearDown() 14 15 localRepo, _ := LocalRepo() 16 gitRemote, _ := localRepo.OriginRemote() 17 assert.Equal(t, "origin", gitRemote.Name) 18 19 u, _ := url.Parse(repo.Remote) 20 assert.Equal(t, u, gitRemote.URL) 21 } 22 23 func TestGitHubRepo_remotesForPublish(t *testing.T) { 24 url, _ := url.Parse("ssh://git@github.com/Owner/repo.git") 25 remotes := []Remote{ 26 { 27 Name: "Owner", 28 URL: url, 29 }, 30 } 31 repo := GitHubRepo{remotes} 32 remotesForPublish := repo.remotesForPublish("owner") 33 34 assert.Equal(t, 1, len(remotesForPublish)) 35 assert.Equal(t, "Owner", remotesForPublish[0].Name) 36 assert.Equal(t, url.String(), remotesForPublish[0].URL.String()) 37 }