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