Skip to content

Commit 0821428

Browse files
sfe/unpause: Test that identifiers appear on confirmation (#8087)
#8075 fixed a rendering issue caused by #8066, now test that identifier(s) are always rendered as expected.
1 parent 53c35ac commit 0821428

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

sfe/sfe_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func TestUnpausePaths(t *testing.T) {
128128
test.AssertEquals(t, responseWriter.Code, http.StatusOK)
129129
test.AssertContains(t, responseWriter.Body.String(), "Expired unpause URL")
130130

131-
// GET with a valid JWT
131+
// GET with a valid JWT and a single identifier
132132
validJWT, err := unpause.GenerateJWT(unpauseSigner, 1234567890, []string{"example.com"}, time.Hour, fc)
133133
test.AssertNotError(t, err, "Should have been able to create JWT, but could not")
134134
responseWriter = httptest.NewRecorder()
@@ -138,6 +138,21 @@ func TestUnpausePaths(t *testing.T) {
138138
})
139139
test.AssertEquals(t, responseWriter.Code, http.StatusOK)
140140
test.AssertContains(t, responseWriter.Body.String(), "Action required to unpause your account")
141+
test.AssertContains(t, responseWriter.Body.String(), "example.com")
142+
143+
// GET with a valid JWT and multiple identifiers
144+
validJWT, err = unpause.GenerateJWT(unpauseSigner, 1234567890, []string{"example.com", "example.net", "example.org"}, time.Hour, fc)
145+
test.AssertNotError(t, err, "Should have been able to create JWT, but could not")
146+
responseWriter = httptest.NewRecorder()
147+
sfe.UnpauseForm(responseWriter, &http.Request{
148+
Method: "GET",
149+
URL: mustParseURL(unpause.GetForm + "?jwt=" + validJWT),
150+
})
151+
test.AssertEquals(t, responseWriter.Code, http.StatusOK)
152+
test.AssertContains(t, responseWriter.Body.String(), "Action required to unpause your account")
153+
test.AssertContains(t, responseWriter.Body.String(), "example.com")
154+
test.AssertContains(t, responseWriter.Body.String(), "example.net")
155+
test.AssertContains(t, responseWriter.Body.String(), "example.org")
141156

142157
// POST with an expired JWT
143158
responseWriter = httptest.NewRecorder()

0 commit comments

Comments
 (0)