(t *testing.T)
| 183 | } |
| 184 | |
| 185 | func TestParseRemotes(t *testing.T) { |
| 186 | remoteList := []string{ |
| 187 | "mona\tgit@github.com:monalisa/myfork.git (fetch)", |
| 188 | "origin\thttps://github.com/monalisa/octo-cat.git (fetch)", |
| 189 | "origin\thttps://github.com/monalisa/octo-cat-push.git (push)", |
| 190 | "upstream\thttps://example.com/nowhere.git (fetch)", |
| 191 | "upstream\thttps://github.com/hubot/tools (push)", |
| 192 | "zardoz\thttps://example.com/zed.git (push)", |
| 193 | "koke\tgit://github.com/koke/grit.git (fetch)", |
| 194 | "koke\tgit://github.com/koke/grit.git (push)", |
| 195 | } |
| 196 | |
| 197 | r := parseRemotes(remoteList) |
| 198 | assert.Equal(t, 5, len(r)) |
| 199 | |
| 200 | assert.Equal(t, "mona", r[0].Name) |
| 201 | assert.Equal(t, "ssh://git@github.com/monalisa/myfork.git", r[0].FetchURL.String()) |
| 202 | assert.Nil(t, r[0].PushURL) |
| 203 | |
| 204 | assert.Equal(t, "origin", r[1].Name) |
| 205 | assert.Equal(t, "/monalisa/octo-cat.git", r[1].FetchURL.Path) |
| 206 | assert.Equal(t, "/monalisa/octo-cat-push.git", r[1].PushURL.Path) |
| 207 | |
| 208 | assert.Equal(t, "upstream", r[2].Name) |
| 209 | assert.Equal(t, "example.com", r[2].FetchURL.Host) |
| 210 | assert.Equal(t, "github.com", r[2].PushURL.Host) |
| 211 | |
| 212 | assert.Equal(t, "zardoz", r[3].Name) |
| 213 | assert.Nil(t, r[3].FetchURL) |
| 214 | assert.Equal(t, "https://example.com/zed.git", r[3].PushURL.String()) |
| 215 | |
| 216 | assert.Equal(t, "koke", r[4].Name) |
| 217 | assert.Equal(t, "/koke/grit.git", r[4].FetchURL.Path) |
| 218 | assert.Equal(t, "/koke/grit.git", r[4].PushURL.Path) |
| 219 | } |
| 220 | |
| 221 | func TestClientUpdateRemoteURL(t *testing.T) { |
| 222 | tests := []struct { |
nothing calls this directly
no test coverage detected