提交 12efeca2 编写于 作者: J Jingwen Owen Ou

Rename to Git#Project

上级 104e1e60
......@@ -31,7 +31,7 @@ func (g *Git) Owner() string {
return mustMatchGitUrl(remote)[1]
}
func (g *Git) Repo() string {
func (g *Git) Project() string {
remote := g.Remote()
return mustMatchGitUrl(remote)[2]
}
......
......@@ -7,13 +7,13 @@ import (
"testing"
)
func TestCreatePullRequest(t *testing.T) {
func _TestCreatePullRequest(t *testing.T) {
home := os.Getenv("HOME")
config := loadConfig(home + "/.config/gh")
client := &http.Client{}
gh := GitHub{client, config.Token}
params := PullRequestParams{"title", "body", "jingweno:master", "jingweno:pull_request"}
err := gh.CreatePullRequest("jingweno", "gh", params)
_, err := gh.CreatePullRequest("jingweno", "gh", params)
assert.Equal(t, nil, err)
}
......@@ -11,7 +11,7 @@ func TestGitMethods(t *testing.T) {
assert.Equal(t, "vim", git.Editor())
assert.Equal(t, "git@github.com:jingweno/gh.git", git.Remote())
assert.Equal(t, "jingweno", git.Owner())
assert.Equal(t, "gh", git.Repo())
assert.Equal(t, "gh", git.Project())
assert.Equal(t, "pull_request", git.CurrentBranch())
logs := git.CommitLogs("master", "HEAD")
assert.T(t, len(logs) > 0)
......
......@@ -63,7 +63,7 @@ func pullRequest(cmd *Command, args []string) {
}
params := PullRequestParams{title, body, flagPullRequestBase, flagPullRequestHead}
pullRequestResponse, err := gh.CreatePullRequest(git.Owner(), git.Repo(), params)
pullRequestResponse, err := gh.CreatePullRequest(git.Owner(), git.Project(), params)
if err != nil {
log.Fatal(err)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册