From 13b0c1efb827c28cd9ce9bdf24226eb840c0fe6c Mon Sep 17 00:00:00 2001 From: Antoine Bluchet Date: Sat, 28 Sep 2024 09:45:13 +0200 Subject: [PATCH] test: remove hydra prefix from errors (#6681) --- features/hydra/collection.feature | 2 +- features/main/crud.feature | 4 +-- features/main/not_exposed.feature | 2 +- features/main/validation.feature | 12 ++++---- features/security/strong_typing.feature | 30 +++++++++---------- .../validate_incoming_content-types.feature | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/features/hydra/collection.feature b/features/hydra/collection.feature index 0f29bf4c711..399c7af4bb6 100644 --- a/features/hydra/collection.feature +++ b/features/hydra/collection.feature @@ -480,7 +480,7 @@ Feature: Collections support When I send a "GET" request to "/dummies?itemsPerPage=0&page=2" Then the response status code should be 400 - And the JSON node "hydra:description" should be equal to "Page should not be greater than 1 if limit is equal to 0" + And the JSON node "description" should be equal to "Page should not be greater than 1 if limit is equal to 0" Scenario: Cursor-based pagination with an empty collection When I send a "GET" request to "/so_manies" diff --git a/features/main/crud.feature b/features/main/crud.feature index a167ef70e45..8dc25500ad2 100644 --- a/features/main/crud.feature +++ b/features/main/crud.feature @@ -95,7 +95,7 @@ Feature: Create-Retrieve-Update-Delete When I add "Content-Type" header equal to "application/ld+json" And I send a "POST" request to "/dummies" Then the response status code should be 400 - And the JSON node "hydra:description" should be equal to "Syntax error" + And the JSON node "description" should be equal to "Syntax error" Scenario: Get a not found exception When I send a "GET" request to "/dummies/42" @@ -552,7 +552,7 @@ Feature: Create-Retrieve-Update-Delete When I add "Content-Type" header equal to "application/ld+json" And I send a "PUT" request to "/dummies/1" Then the response status code should be 400 - And the JSON node "hydra:description" should be equal to "Syntax error" + And the JSON node "description" should be equal to "Syntax error" Scenario: Delete a resource When I send a "DELETE" request to "/dummies/1" diff --git a/features/main/not_exposed.feature b/features/main/not_exposed.feature index 09f4d8691d9..5e6173052f6 100644 --- a/features/main/not_exposed.feature +++ b/features/main/not_exposed.feature @@ -171,7 +171,7 @@ Feature: Expose only a collection of objects When I send a "GET" request to "" Then the response status code should be 404 And the response should be in JSON - And the JSON node "hydra:description" should be equal to "" + And the JSON node "description" should be equal to "" Examples: | uri | description | | /tables/12345 | This route does not aim to be called. | diff --git a/features/main/validation.feature b/features/main/validation.feature index be2e9e5ca53..42aa8621f05 100644 --- a/features/main/validation.feature +++ b/features/main/validation.feature @@ -31,8 +31,8 @@ Feature: Using validations groups { "@context": "/contexts/ConstraintViolationList", "@type": "ConstraintViolationList", - "hydra:title": "An error occurred", - "hydra:description": "name: This value should not be null.", + "title": "An error occurred", + "description": "name: This value should not be null.", "violations": [ { "propertyPath": "name", @@ -60,8 +60,8 @@ Feature: Using validations groups { "@context": "/contexts/ConstraintViolationList", "@type": "ConstraintViolationList", - "hydra:title": "An error occurred", - "hydra:description": "title: This value should not be null.", + "title": "An error occurred", + "description": "title: This value should not be null.", "violations": [ { "propertyPath": "title", @@ -113,8 +113,8 @@ Feature: Using validations groups { "@context": "/contexts/ConstraintViolationList", "@type": "ConstraintViolationList", - "hydra:title": "An error occurred", - "hydra:description": "This value should be of type unknown.\nqux: This value should be of type string.\nfoo: This value should be of type bool.\nbar: This value should be of type int.\nuuid: This value should be of type uuid.\nrelatedDummy: This value should be of type array|string.\nrelatedDummies: This value should be of type array.", + "title": "An error occurred", + "description": "This value should be of type unknown.\nqux: This value should be of type string.\nfoo: This value should be of type bool.\nbar: This value should be of type int.\nuuid: This value should be of type uuid.\nrelatedDummy: This value should be of type array|string.\nrelatedDummies: This value should be of type array.", "violations": [ { "propertyPath": "", diff --git a/features/security/strong_typing.feature b/features/security/strong_typing.feature index d69c670b3fe..a12d3c354f0 100644 --- a/features/security/strong_typing.feature +++ b/features/security/strong_typing.feature @@ -54,9 +54,9 @@ Feature: Handle properly invalid data submitted to the API And the response should be in JSON And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" And the JSON node "@context" should be equal to "/contexts/Error" - And the JSON node "@type" should be equal to "hydra:Error" - And the JSON node "hydra:title" should be equal to "An error occurred" - And the JSON node "hydra:description" should be equal to 'The type of the "name" attribute must be "string", "NULL" given.' + And the JSON node "@type" should be equal to "Error" + And the JSON node "title" should be equal to "An error occurred" + And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "NULL" given.' Scenario: Create a resource with wrong value type for relation When I add "Content-Type" header equal to "application/ld+json" @@ -71,9 +71,9 @@ Feature: Handle properly invalid data submitted to the API And the response should be in JSON And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" And the JSON node "@context" should be equal to "/contexts/Error" - And the JSON node "@type" should be equal to "hydra:Error" - And the JSON node "hydra:title" should be equal to "An error occurred" - And the JSON node "hydra:description" should be equal to 'Invalid IRI "1".' + And the JSON node "@type" should be equal to "Error" + And the JSON node "title" should be equal to "An error occurred" + And the JSON node "description" should be equal to 'Invalid IRI "1".' And the JSON node "trace" should exist Scenario: Ignore invalid dates @@ -102,9 +102,9 @@ Feature: Handle properly invalid data submitted to the API And the response should be in JSON And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" And the JSON node "@context" should be equal to "/contexts/Error" - And the JSON node "@type" should be equal to "hydra:Error" - And the JSON node "hydra:title" should be equal to "An error occurred" - And the JSON node "hydra:description" should be equal to 'The type of the "relatedDummies" attribute must be "array", "string" given.' + And the JSON node "@type" should be equal to "Error" + And the JSON node "title" should be equal to "An error occurred" + And the JSON node "description" should be equal to 'The type of the "relatedDummies" attribute must be "array", "string" given.' And the JSON node "trace" should exist Scenario: Send an object where an array is expected @@ -120,9 +120,9 @@ Feature: Handle properly invalid data submitted to the API And the response should be in JSON And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" And the JSON node "@context" should be equal to "/contexts/Error" - And the JSON node "@type" should be equal to "hydra:Error" - And the JSON node "hydra:title" should be equal to "An error occurred" - And the JSON node "hydra:description" should be equal to 'The type of the key "a" must be "int", "string" given.' + And the JSON node "@type" should be equal to "Error" + And the JSON node "title" should be equal to "An error occurred" + And the JSON node "description" should be equal to 'The type of the key "a" must be "int", "string" given.' Scenario: Send a scalar having the bad type When I add "Content-Type" header equal to "application/ld+json" @@ -136,9 +136,9 @@ Feature: Handle properly invalid data submitted to the API And the response should be in JSON And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" And the JSON node "@context" should be equal to "/contexts/Error" - And the JSON node "@type" should be equal to "hydra:Error" - And the JSON node "hydra:title" should be equal to "An error occurred" - And the JSON node "hydra:description" should be equal to 'The type of the "name" attribute must be "string", "integer" given.' + And the JSON node "@type" should be equal to "Error" + And the JSON node "title" should be equal to "An error occurred" + And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "integer" given.' Scenario: According to the JSON spec, allow numbers without explicit floating point for JSON formats When I add "Content-Type" header equal to "application/ld+json" diff --git a/features/security/validate_incoming_content-types.feature b/features/security/validate_incoming_content-types.feature index bc947705479..27a75000822 100644 --- a/features/security/validate_incoming_content-types.feature +++ b/features/security/validate_incoming_content-types.feature @@ -14,4 +14,4 @@ Feature: Validate incoming content type """ Then the response status code should be 415 And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8" - And the JSON node "hydra:description" should be equal to 'The content-type "text/plain" is not supported. Supported MIME types are "application/ld+json", "application/hal+json", "application/vnd.api+json", "application/xml", "text/xml", "application/json", "text/html", "application/graphql", "multipart/form-data".' + And the JSON node "description" should be equal to 'The content-type "text/plain" is not supported. Supported MIME types are "application/ld+json", "application/hal+json", "application/vnd.api+json", "application/xml", "text/xml", "application/json", "text/html", "application/graphql", "multipart/form-data".'