(t *testing.T)
| 1202 | } |
| 1203 | |
| 1204 | func TestTokenRevocationResponseOk(t *testing.T) { |
| 1205 | t.Parallel() |
| 1206 | |
| 1207 | ghType := codersdk.EnhancedExternalAuthProviderGitHub.String() |
| 1208 | rfcType := codersdk.EnhancedExternalAuthProviderAzureDevops.String() |
| 1209 | tests := []struct { |
| 1210 | name string |
| 1211 | conf *externalauth.Config |
| 1212 | resp http.Response |
| 1213 | want bool |
| 1214 | }{ |
| 1215 | { |
| 1216 | name: "GH_bad", |
| 1217 | conf: &externalauth.Config{Type: ghType}, |
| 1218 | resp: http.Response{StatusCode: http.StatusOK}, |
| 1219 | want: false, |
| 1220 | }, |
| 1221 | { |
| 1222 | name: "GH_ok", |
| 1223 | conf: &externalauth.Config{Type: ghType}, |
| 1224 | resp: http.Response{StatusCode: http.StatusNoContent}, |
| 1225 | want: true, |
| 1226 | }, |
| 1227 | { |
| 1228 | name: "RFC_ok", |
| 1229 | conf: &externalauth.Config{Type: rfcType}, |
| 1230 | resp: http.Response{StatusCode: http.StatusOK}, |
| 1231 | want: true, |
| 1232 | }, |
| 1233 | { |
| 1234 | name: "RFC_bad", |
| 1235 | conf: &externalauth.Config{Type: rfcType}, |
| 1236 | resp: http.Response{StatusCode: http.StatusNoContent}, |
| 1237 | want: false, |
| 1238 | }, |
| 1239 | } |
| 1240 | for _, tc := range tests { |
| 1241 | t.Run(tc.name, func(t *testing.T) { |
| 1242 | t.Parallel() |
| 1243 | got := tc.conf.TokenRevocationResponseOk(&tc.resp) |
| 1244 | if tc.want != got { |
| 1245 | t.Errorf("unexpected response success, got: %v want: %v", got, tc.want) |
| 1246 | } |
| 1247 | }) |
| 1248 | } |
| 1249 | } |
| 1250 | |
| 1251 | func TestConvertYAML(t *testing.T) { |
| 1252 | t.Parallel() |
nothing calls this directly
no test coverage detected