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