(t *testing.T)
| 553 | } |
| 554 | |
| 555 | func (s) TestConstructRequest(t *testing.T) { |
| 556 | tests := []struct { |
| 557 | name string |
| 558 | opts Options |
| 559 | subjectTokenReadErr bool |
| 560 | actorTokenReadErr bool |
| 561 | wantReqParams *requestParameters |
| 562 | wantErr bool |
| 563 | }{ |
| 564 | { |
| 565 | name: "subject token read failure", |
| 566 | subjectTokenReadErr: true, |
| 567 | opts: goodOptions, |
| 568 | wantErr: true, |
| 569 | }, |
| 570 | { |
| 571 | name: "actor token read failure", |
| 572 | actorTokenReadErr: true, |
| 573 | opts: Options{ |
| 574 | TokenExchangeServiceURI: serviceURI, |
| 575 | Audience: exampleAudience, |
| 576 | RequestedTokenType: requestedTokenType, |
| 577 | SubjectTokenPath: subjectTokenPath, |
| 578 | SubjectTokenType: subjectTokenType, |
| 579 | ActorTokenPath: actorTokenPath, |
| 580 | ActorTokenType: actorTokenType, |
| 581 | }, |
| 582 | wantErr: true, |
| 583 | }, |
| 584 | { |
| 585 | name: "default cloud platform scope", |
| 586 | opts: goodOptions, |
| 587 | wantReqParams: goodRequestParams, |
| 588 | }, |
| 589 | { |
| 590 | name: "all good", |
| 591 | opts: Options{ |
| 592 | TokenExchangeServiceURI: serviceURI, |
| 593 | Resource: exampleResource, |
| 594 | Audience: exampleAudience, |
| 595 | Scope: testScope, |
| 596 | RequestedTokenType: requestedTokenType, |
| 597 | SubjectTokenPath: subjectTokenPath, |
| 598 | SubjectTokenType: subjectTokenType, |
| 599 | ActorTokenPath: actorTokenPath, |
| 600 | ActorTokenType: actorTokenType, |
| 601 | }, |
| 602 | wantReqParams: &requestParameters{ |
| 603 | GrantType: tokenExchangeGrantType, |
| 604 | Resource: exampleResource, |
| 605 | Audience: exampleAudience, |
| 606 | Scope: testScope, |
| 607 | RequestedTokenType: requestedTokenType, |
| 608 | SubjectToken: subjectTokenContents, |
| 609 | SubjectTokenType: subjectTokenType, |
| 610 | ActorToken: actorTokenContents, |
| 611 | ActorTokenType: actorTokenType, |
| 612 | }, |
nothing calls this directly
no test coverage detected