(t *testing.T)
| 1235 | } |
| 1236 | |
| 1237 | func TestBuildAuthResponseCodeResponsePayload(t *testing.T) { |
| 1238 | type args struct { |
| 1239 | authReq op.AuthRequest |
| 1240 | authorizer func(*testing.T) op.Authorizer |
| 1241 | } |
| 1242 | type res struct { |
| 1243 | wantCode string |
| 1244 | wantState string |
| 1245 | wantSessionState string |
| 1246 | wantErr bool |
| 1247 | } |
| 1248 | tests := []struct { |
| 1249 | name string |
| 1250 | args args |
| 1251 | res res |
| 1252 | }{ |
| 1253 | { |
| 1254 | name: "create code error", |
| 1255 | args: args{ |
| 1256 | authReq: &storage.AuthRequest{ |
| 1257 | ID: "id1", |
| 1258 | }, |
| 1259 | authorizer: func(t *testing.T) op.Authorizer { |
| 1260 | ctrl := gomock.NewController(t) |
| 1261 | storage := mock.NewMockStorage(ctrl) |
| 1262 | |
| 1263 | authorizer := mock.NewMockAuthorizer(ctrl) |
| 1264 | authorizer.EXPECT().Storage().Return(storage) |
| 1265 | authorizer.EXPECT().Crypto().Return(&mockCrypto{ |
| 1266 | returnErr: io.ErrClosedPipe, |
| 1267 | }) |
| 1268 | return authorizer |
| 1269 | }, |
| 1270 | }, |
| 1271 | res: res{ |
| 1272 | wantErr: true, |
| 1273 | }, |
| 1274 | }, |
| 1275 | { |
| 1276 | name: "success with state", |
| 1277 | args: args{ |
| 1278 | authReq: &storage.AuthRequest{ |
| 1279 | ID: "id1", |
| 1280 | TransferState: "state1", |
| 1281 | }, |
| 1282 | authorizer: func(t *testing.T) op.Authorizer { |
| 1283 | ctrl := gomock.NewController(t) |
| 1284 | storage := mock.NewMockStorage(ctrl) |
| 1285 | storage.EXPECT().SaveAuthCode(gomock.Any(), "id1", "id1") |
| 1286 | |
| 1287 | authorizer := mock.NewMockAuthorizer(ctrl) |
| 1288 | authorizer.EXPECT().Storage().Return(storage) |
| 1289 | authorizer.EXPECT().Crypto().Return(&mockCrypto{}) |
| 1290 | return authorizer |
| 1291 | }, |
| 1292 | }, |
| 1293 | res: res{ |
| 1294 | wantCode: "id1", |
nothing calls this directly
no test coverage detected
searching dependent graphs…