@@ -942,6 +942,27 @@ func TestChallenge(t *testing.T) {
942942 test .AssertEquals (t , responseWriter .Code , http .StatusNotFound )
943943 assertJSONEquals (t , responseWriter .Body .String (),
944944 `{"type":"urn:acme:error:malformed","detail":"Expired authorization","status":404}` )
945+
946+ // Challenge Not found
947+ challengeURL = ""
948+ responseWriter = httptest .NewRecorder ()
949+ wfe .Challenge (ctx , newRequestEvent (), responseWriter ,
950+ makePostRequestWithPath (challengeURL ,
951+ signRequest (t , `{"resource":"challenge"}` , wfe .nonceService )))
952+ test .AssertEquals (t , responseWriter .Code , http .StatusNotFound )
953+ assertJSONEquals (t , responseWriter .Body .String (),
954+ `{"type":"urn:acme:error:malformed","detail":"No such challenge","status":404}` )
955+
956+ // Unspecified database error
957+ errorURL := "error_result/24"
958+ responseWriter = httptest .NewRecorder ()
959+ wfe .Challenge (ctx , newRequestEvent (), responseWriter ,
960+ makePostRequestWithPath (errorURL ,
961+ signRequest (t , `{"resource":"challenge"}` , wfe .nonceService )))
962+ test .AssertEquals (t , responseWriter .Code , http .StatusInternalServerError )
963+ assertJSONEquals (t , responseWriter .Body .String (),
964+ `{"type":"urn:acme:error:serverInternal","detail":"Problem getting authorization","status":500}` )
965+
945966}
946967
947968func TestBadNonce (t * testing.T ) {
0 commit comments