(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func TestIDPMakeErrorResponse(t *testing.T) { |
| 91 | test := idpErrNewTest(t) |
| 92 | req := idpErrValidRequest(t, test) |
| 93 | |
| 94 | assert.NilError(t, req.MakeErrorResponse(StatusResponder, StatusNoPassive, "cannot authenticate passively")) |
| 95 | assert.Check(t, req.Assertion == nil) |
| 96 | assert.Check(t, req.AssertionEl == nil) |
| 97 | idpErrCheckErrorResponse(t, test, req.ResponseEl, req.Request.ID, StatusResponder, StatusNoPassive, "cannot authenticate passively") |
| 98 | |
| 99 | // The Response unmarshals into the package's Response type. |
| 100 | var response Response |
| 101 | assert.NilError(t, unmarshalEtreeHack(req.ResponseEl.Copy(), &response)) |
| 102 | assert.Check(t, is.Equal(StatusResponder, response.Status.StatusCode.Value)) |
| 103 | assert.Check(t, response.Assertion == nil) |
| 104 | |
| 105 | // It is posted to the ACS with the RelayState, like a success Response. |
| 106 | w := httptest.NewRecorder() |
| 107 | assert.NilError(t, req.WriteResponse(w)) |
| 108 | _, action, fields := idpErrResponseFromForm(t, w.Body.Bytes()) |
| 109 | assert.Check(t, is.Equal(test.SP.AcsURL.String(), action)) |
| 110 | assert.Check(t, is.DeepEqual([]string{"relay"}, fields["RelayState"])) |
| 111 | |
| 112 | idpErrCheckSPRejects(t, test, w.Body.Bytes(), []string{req.Request.ID}, StatusResponder) |
| 113 | } |
| 114 | |
| 115 | func TestIDPMakeErrorResponseWithoutSecondLevelOrMessage(t *testing.T) { |
| 116 | test := idpErrNewTest(t) |
nothing calls this directly
no test coverage detected