(t *testing.T)
| 112 | } |
| 113 | |
| 114 | func Test_SmartBaseRepo(t *testing.T) { |
| 115 | pu, _ := url.Parse("https://test.com/newowner/newrepo.git") |
| 116 | |
| 117 | tests := []struct { |
| 118 | name string |
| 119 | remotes git.RemoteSet |
| 120 | override string |
| 121 | wantsErr bool |
| 122 | wantsName string |
| 123 | wantsOwner string |
| 124 | wantsHost string |
| 125 | tty bool |
| 126 | httpStubs func(*httpmock.Registry) |
| 127 | }{ |
| 128 | { |
| 129 | name: "override with matching remote", |
| 130 | remotes: git.RemoteSet{ |
| 131 | git.NewRemote("origin", "https://test.com/owner/repo.git"), |
| 132 | }, |
| 133 | override: "test.com", |
| 134 | wantsName: "repo", |
| 135 | wantsOwner: "owner", |
| 136 | wantsHost: "test.com", |
| 137 | }, |
| 138 | { |
| 139 | name: "override with matching remote and base resolution", |
| 140 | remotes: git.RemoteSet{ |
| 141 | &git.Remote{Name: "origin", |
| 142 | Resolved: "base", |
| 143 | FetchURL: pu, |
| 144 | PushURL: pu}, |
| 145 | }, |
| 146 | override: "test.com", |
| 147 | wantsName: "newrepo", |
| 148 | wantsOwner: "newowner", |
| 149 | wantsHost: "test.com", |
| 150 | }, |
| 151 | { |
| 152 | name: "override with matching remote and nonbase resolution", |
| 153 | remotes: git.RemoteSet{ |
| 154 | &git.Remote{Name: "origin", |
| 155 | Resolved: "johnny/test", |
| 156 | FetchURL: pu, |
| 157 | PushURL: pu}, |
| 158 | }, |
| 159 | override: "test.com", |
| 160 | wantsName: "test", |
| 161 | wantsOwner: "johnny", |
| 162 | wantsHost: "test.com", |
| 163 | }, |
| 164 | { |
| 165 | name: "override with no matching remote", |
| 166 | remotes: git.RemoteSet{ |
| 167 | git.NewRemote("origin", "https://example.com/owner/repo.git"), |
| 168 | }, |
| 169 | override: "test.com", |
| 170 | wantsErr: true, |
| 171 | }, |
nothing calls this directly
no test coverage detected