github.com/scorpionis/hub@v2.2.1+incompatible/git/ssh_config_test.go (about)

     1  package git
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/github/hub/Godeps/_workspace/src/github.com/bmizerany/assert"
     9  )
    10  
    11  func TestSSHConfigReader_Read(t *testing.T) {
    12  	f, _ := ioutil.TempFile("", "ssh-config")
    13  	c := `Host github.com
    14    Hostname ssh.github.com
    15    Port 443
    16  
    17  	host other
    18  	Hostname 10.0.0.1
    19  	`
    20  
    21  	ioutil.WriteFile(f.Name(), []byte(c), os.ModePerm)
    22  
    23  	r := &SSHConfigReader{[]string{f.Name()}}
    24  	sc := r.Read()
    25  	assert.Equal(t, "ssh.github.com", sc["github.com"])
    26  }