From 946a43e030e04c33c8d74ec3fa7c4645998c2cc1 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Tue, 21 Nov 2023 15:57:59 -0300 Subject: [PATCH 1/2] Improve test to check caching directives are kept in Not Modified response --- .../AuthenticatedPetStoreAPITest.class.st | 50 ++++++------ .../PetOrdersRESTfulControllerTest.class.st | 72 ++++++++--------- .../PetStoreAPITest.class.st | 42 +++++----- .../PetsRESTfulControllerTest.class.st | 78 ++++++++++--------- ...anCurrenciesRESTfulControllerTest.class.st | 70 +++++++++-------- source/Stargate-Examples-Tests/package.st | 2 +- 6 files changed, 165 insertions(+), 149 deletions(-) diff --git a/source/Stargate-Examples-Tests/AuthenticatedPetStoreAPITest.class.st b/source/Stargate-Examples-Tests/AuthenticatedPetStoreAPITest.class.st index 35edc31..4554a26 100644 --- a/source/Stargate-Examples-Tests/AuthenticatedPetStoreAPITest.class.st +++ b/source/Stargate-Examples-Tests/AuthenticatedPetStoreAPITest.class.st @@ -1,14 +1,16 @@ Class { - #name : #AuthenticatedPetStoreAPITest, - #superclass : #HTTPBasedRESTfulAPITest, + #name : 'AuthenticatedPetStoreAPITest', + #superclass : 'HTTPBasedRESTfulAPITest', #instVars : [ 'petsController', 'ordersController' ], - #category : #'Stargate-Examples-Tests-PetStore' + #category : 'Stargate-Examples-Tests-PetStore', + #package : 'Stargate-Examples-Tests', + #tag : 'PetStore' } -{ #category : #'tests - support' } +{ #category : 'tests - support' } AuthenticatedPetStoreAPITest >> assert: aResponse canBeSharedWithRequestsFrom: anOriginLocation [ self @@ -16,14 +18,14 @@ AuthenticatedPetStoreAPITest >> assert: aResponse canBeSharedWithRequestsFrom: a equals: anOriginLocation asWebOrigin asString ] -{ #category : #private } +{ #category : 'private' } AuthenticatedPetStoreAPITest >> controllersToInstall [ ^ {petsController. ordersController} ] -{ #category : #running } +{ #category : 'running' } AuthenticatedPetStoreAPITest >> setUpAPI [ petsController := PetsRESTfulController new. @@ -33,7 +35,7 @@ AuthenticatedPetStoreAPITest >> setUpAPI [ ( JWTBearerAuthenticationFilter with: self secret forAlgorithmNamed: self algorithmName ) ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testBadRequest [ self @@ -48,7 +50,7 @@ AuthenticatedPetStoreAPITest >> testBadRequest [ withExceptionDo: [ :error | self assert: error response isBadRequest ] ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } AuthenticatedPetStoreAPITest >> testCORSAllowingAnyOrigin [ | response | @@ -80,7 +82,7 @@ AuthenticatedPetStoreAPITest >> testCORSAllowingAnyOrigin [ assert: ( response headers at: 'Access-Control-Allow-Origin' ) equals: '*' ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } AuthenticatedPetStoreAPITest >> testCORSAllowingExactlyOneOrigin [ | response | @@ -114,7 +116,7 @@ AuthenticatedPetStoreAPITest >> testCORSAllowingExactlyOneOrigin [ assert: response canBeSharedWithRequestsFrom: self baseUrl ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } AuthenticatedPetStoreAPITest >> testCORSAllowingMoreThanOneOrigin [ | response | @@ -154,7 +156,7 @@ AuthenticatedPetStoreAPITest >> testCORSAllowingMoreThanOneOrigin [ assert: response canBeSharedWithRequestsFrom: self baseUrl ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } AuthenticatedPetStoreAPITest >> testCORSOptionalHeaders [ | response | @@ -203,7 +205,7 @@ AuthenticatedPetStoreAPITest >> testCORSOptionalHeaders [ deny: response varyHeaderNames includes: 'Access-Control-Allow-Headers' ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } AuthenticatedPetStoreAPITest >> testCORSRespondWithEmptyHeadersIfOriginNotAllowed [ | response | @@ -234,7 +236,7 @@ AuthenticatedPetStoreAPITest >> testCORSRespondWithEmptyHeadersIfOriginNotAllowe should: [ response headers at: 'Access-Control-Allow-Origin' ] raise: KeyNotFound ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testConflict [ self newJWTAuthorizedClient @@ -262,7 +264,7 @@ AuthenticatedPetStoreAPITest >> testConflict [ ] ] -{ #category : #tests } +{ #category : 'tests' } AuthenticatedPetStoreAPITest >> testCreatePet [ | response json | @@ -290,7 +292,7 @@ AuthenticatedPetStoreAPITest >> testCreatePet [ assert: json selfLocation equals: response location ] -{ #category : #'tests - authentication' } +{ #category : 'tests - authentication' } AuthenticatedPetStoreAPITest >> testCreatePetUnauthorized [ self @@ -306,7 +308,7 @@ AuthenticatedPetStoreAPITest >> testCreatePetUnauthorized [ withExceptionDo: [ :error | self assert: error response code equals: 401 ] ] -{ #category : #'tests - authentication' } +{ #category : 'tests - authentication' } AuthenticatedPetStoreAPITest >> testGetOrdersUnauthorized [ self should: [ self newClient get: self baseUrl / 'orders' asUrl ] @@ -314,7 +316,7 @@ AuthenticatedPetStoreAPITest >> testGetOrdersUnauthorized [ withExceptionDo: [ :error | self assert: error response code equals: 401 ] ] -{ #category : #tests } +{ #category : 'tests' } AuthenticatedPetStoreAPITest >> testGetPets [ | json | @@ -326,7 +328,7 @@ AuthenticatedPetStoreAPITest >> testGetPets [ assert: json links size equals: 1 ] -{ #category : #'tests - authentication' } +{ #category : 'tests - authentication' } AuthenticatedPetStoreAPITest >> testGetPetsUnauthorized [ self should: [ self newClient get: self baseUrl / 'pets' asUrl ] @@ -334,7 +336,7 @@ AuthenticatedPetStoreAPITest >> testGetPetsUnauthorized [ withExceptionDo: [ :error | self assert: error response code equals: 401 ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testMethodNotAllowed [ self newJWTAuthorizedClient @@ -355,7 +357,7 @@ AuthenticatedPetStoreAPITest >> testMethodNotAllowed [ ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testNotAcceptable [ self @@ -369,7 +371,7 @@ AuthenticatedPetStoreAPITest >> testNotAcceptable [ assert: error response hasEntity ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testNotFound [ self @@ -378,7 +380,7 @@ AuthenticatedPetStoreAPITest >> testNotFound [ withExceptionDo: [ :error | self assert: error response isNotFound ] ] -{ #category : #'tests - authentication' } +{ #category : 'tests - authentication' } AuthenticatedPetStoreAPITest >> testNotFoundEndpointUnauthorized [ self should: [ self newClient get: self baseUrl / 'inexistent' asUrl ] @@ -386,7 +388,7 @@ AuthenticatedPetStoreAPITest >> testNotFoundEndpointUnauthorized [ withExceptionDo: [ :error | self assert: error response code equals: 401 ] ] -{ #category : #'tests - authentication' } +{ #category : 'tests - authentication' } AuthenticatedPetStoreAPITest >> testNotPreflightOptionsUnauthorized [ self @@ -400,7 +402,7 @@ AuthenticatedPetStoreAPITest >> testNotPreflightOptionsUnauthorized [ withExceptionDo: [ :error | self assert: error response code equals: 401 ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } AuthenticatedPetStoreAPITest >> testUnsupportedMediaType [ self diff --git a/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st b/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st index b5dae21..b931940 100644 --- a/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st +++ b/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st @@ -2,21 +2,23 @@ I'm a user stoty test testing the service providing the Pet Order resource, in the classic Pet Store example " Class { - #name : #PetOrdersRESTfulControllerTest, - #superclass : #SingleResourceRESTfulControllerTest, + #name : 'PetOrdersRESTfulControllerTest', + #superclass : 'SingleResourceRESTfulControllerTest', #instVars : [ 'orderRepository' ], - #category : #'Stargate-Examples-Tests-PetStore' + #category : 'Stargate-Examples-Tests-PetStore', + #package : 'Stargate-Examples-Tests', + #tag : 'PetStore' } -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> baseUrl [ ^ 'https://petstore.example.com' asUrl ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> commentsRelatedTo: order [ ^ resourceController @@ -25,7 +27,7 @@ PetOrdersRESTfulControllerTest >> commentsRelatedTo: order [ within: self newHttpRequestContext ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> createCommentFor: order identifiedBy: anId withContent: aComment [ | request | @@ -36,7 +38,7 @@ PetOrdersRESTfulControllerTest >> createCommentFor: order identifiedBy: anId wit ^ resourceController createCommentBasedOn: request within: self newHttpRequestContext ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> createOrder [ ^ resourceController @@ -46,7 +48,7 @@ PetOrdersRESTfulControllerTest >> createOrder [ within: self newHttpRequestContext ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> getFirstOrderAndWithJsonDo: aBlock [ | response | @@ -68,7 +70,7 @@ PetOrdersRESTfulControllerTest >> getFirstOrderAndWithJsonDo: aBlock [ self withJsonFromContentsIn: response do: aBlock ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> parametersWith: anOrderId and: aCommentIndex [ ^ ( self parametersWith: anOrderId ) @@ -76,13 +78,13 @@ PetOrdersRESTfulControllerTest >> parametersWith: anOrderId and: aCommentIndex [ yourself ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetOrdersRESTfulControllerTest >> petUrl [ ^ self baseUrl / 'pets/1' asUrl ] -{ #category : #'private - HTTP requests' } +{ #category : 'private - HTTP requests' } PetOrdersRESTfulControllerTest >> requestToDELETEComment: aSubresourceUrl at: aCommentIndex forOrder: anOrderId [ ^ TeaRequest @@ -90,7 +92,7 @@ PetOrdersRESTfulControllerTest >> requestToDELETEComment: aSubresourceUrl at: aC pathParams: ( self parametersWith: anOrderId and: aCommentIndex ) ] -{ #category : #'private - HTTP requests' } +{ #category : 'private - HTTP requests' } PetOrdersRESTfulControllerTest >> requestToGETComment: aSubresourceUrl at: aCommentIndex forOrder: anOrderId [ ^ TeaRequest @@ -101,7 +103,7 @@ PetOrdersRESTfulControllerTest >> requestToGETComment: aSubresourceUrl at: aComm pathParams: ( self parametersWith: anOrderId and: aCommentIndex ) ] -{ #category : #'private - HTTP requests' } +{ #category : 'private - HTTP requests' } PetOrdersRESTfulControllerTest >> requestToPOST: url identifiedBy: anIdentifier [ ^ TeaRequest @@ -109,13 +111,13 @@ PetOrdersRESTfulControllerTest >> requestToPOST: url identifiedBy: anIdentifier pathParams: ( self parametersWith: anIdentifier ) ] -{ #category : #'private - HTTP requests' } +{ #category : 'private - HTTP requests' } PetOrdersRESTfulControllerTest >> requestToPOSTAsOrder: json [ ^ self requestToPOST: json as: resourceController orderVersion1dot0dot0MediaType ] -{ #category : #'private - HTTP requests' } +{ #category : 'private - HTTP requests' } PetOrdersRESTfulControllerTest >> requestToPUTComment: aComment on: aSubresourceUrl at: aCommentIndex forOrder: anOrderId conditionalTo: anETag [ ^ TeaRequest @@ -127,7 +129,7 @@ PetOrdersRESTfulControllerTest >> requestToPUTComment: aComment on: aSubresource pathParams: ( self parametersWith: anOrderId and: aCommentIndex ) ] -{ #category : #running } +{ #category : 'running' } PetOrdersRESTfulControllerTest >> setUp [ orderRepository := InMemoryPetOrderRepository new. @@ -135,13 +137,13 @@ PetOrdersRESTfulControllerTest >> setUp [ self assert: orderRepository findAll isEmpty ] -{ #category : #running } +{ #category : 'running' } PetOrdersRESTfulControllerTest >> setUpResourceController [ resourceController := PetOrdersRESTfulController persistingTo: orderRepository ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testCannnotDeleteComment [ self @@ -156,7 +158,7 @@ PetOrdersRESTfulControllerTest >> testCannnotDeleteComment [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testCannotGetComment [ self @@ -175,7 +177,7 @@ PetOrdersRESTfulControllerTest >> testCannotGetComment [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testCannotUpdateComment [ self @@ -208,7 +210,7 @@ PetOrdersRESTfulControllerTest >> testCannotUpdateComment [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testCannotUpdateCommentWhenETagDoesNotMatch [ self withJsonFromContentsIn: self createOrder do: [ :order | @@ -240,7 +242,7 @@ PetOrdersRESTfulControllerTest >> testCannotUpdateCommentWhenETagDoesNotMatch [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testCommentCreation [ self @@ -268,7 +270,7 @@ PetOrdersRESTfulControllerTest >> testCommentCreation [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testDeleteComment [ self @@ -300,7 +302,7 @@ PetOrdersRESTfulControllerTest >> testDeleteComment [ ] ] -{ #category : #'tests - orders' } +{ #category : 'tests - orders' } PetOrdersRESTfulControllerTest >> testGetCanceledOrder [ self @@ -320,7 +322,7 @@ PetOrdersRESTfulControllerTest >> testGetCanceledOrder [ assertUrl: json selfLocation equals: 'https://petstore.example.com/orders/1' ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testGetComment [ self @@ -343,7 +345,7 @@ PetOrdersRESTfulControllerTest >> testGetComment [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testGetComments [ self @@ -365,7 +367,7 @@ PetOrdersRESTfulControllerTest >> testGetComments [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testGetCommentsForJustCreatedOrder [ self @@ -385,7 +387,7 @@ PetOrdersRESTfulControllerTest >> testGetCommentsForJustCreatedOrder [ ] ] -{ #category : #'tests - orders' } +{ #category : 'tests - orders' } PetOrdersRESTfulControllerTest >> testGetOrderJustCreated [ self @@ -399,7 +401,7 @@ PetOrdersRESTfulControllerTest >> testGetOrderJustCreated [ assertUrl: json links complete equals: 'https://petstore.example.com/orders/1/complete' ] ] -{ #category : #'tests - orders' } +{ #category : 'tests - orders' } PetOrdersRESTfulControllerTest >> testHATEOAS [ "This case will transition an order from registered to completed to canceled, using the hypermedia controls provided @@ -441,7 +443,7 @@ PetOrdersRESTfulControllerTest >> testHATEOAS [ ] ] -{ #category : #'tests - orders' } +{ #category : 'tests - orders' } PetOrdersRESTfulControllerTest >> testInvalidStateTransition [ | completeOrderLink | @@ -462,7 +464,7 @@ PetOrdersRESTfulControllerTest >> testInvalidStateTransition [ withExceptionDo: [ :error | self assert: error code equals: 409 ] ] -{ #category : #'tests - orders' } +{ #category : 'tests - orders' } PetOrdersRESTfulControllerTest >> testOrderCreation [ | response | @@ -478,7 +480,7 @@ PetOrdersRESTfulControllerTest >> testOrderCreation [ assert: orderRepository findAll first pet equals: self petUrl ] -{ #category : #tests } +{ #category : 'tests' } PetOrdersRESTfulControllerTest >> testRoutes [ | routes | @@ -496,7 +498,7 @@ PetOrdersRESTfulControllerTest >> testRoutes [ '/orders//comments/' ) ) ] -{ #category : #tests } +{ #category : 'tests' } PetOrdersRESTfulControllerTest >> testTemplate [ | controller | @@ -512,7 +514,7 @@ PetOrdersRESTfulControllerTest >> testTemplate [ equals: '/orders//comments/' ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testUpdateComment [ self @@ -550,7 +552,7 @@ PetOrdersRESTfulControllerTest >> testUpdateComment [ ] ] -{ #category : #'tests - comments' } +{ #category : 'tests - comments' } PetOrdersRESTfulControllerTest >> testUpdateCommentAcceptingADifferentMediaType [ "Test for https://github.com/ba-st/Stargate/issues/164" diff --git a/source/Stargate-Examples-Tests/PetStoreAPITest.class.st b/source/Stargate-Examples-Tests/PetStoreAPITest.class.st index 37df320..7a81fa2 100644 --- a/source/Stargate-Examples-Tests/PetStoreAPITest.class.st +++ b/source/Stargate-Examples-Tests/PetStoreAPITest.class.st @@ -2,16 +2,18 @@ Test " Class { - #name : #PetStoreAPITest, - #superclass : #HTTPBasedRESTfulAPITest, + #name : 'PetStoreAPITest', + #superclass : 'HTTPBasedRESTfulAPITest', #instVars : [ 'petsController', 'ordersController' ], - #category : #'Stargate-Examples-Tests-PetStore' + #category : 'Stargate-Examples-Tests-PetStore', + #package : 'Stargate-Examples-Tests', + #tag : 'PetStore' } -{ #category : #'tests - support' } +{ #category : 'tests - support' } PetStoreAPITest >> assert: aResponse canBeSharedWithRequestsFrom: anOriginLocation [ self @@ -19,20 +21,20 @@ PetStoreAPITest >> assert: aResponse canBeSharedWithRequestsFrom: anOriginLocati equals: anOriginLocation asWebOrigin asString ] -{ #category : #private } +{ #category : 'private' } PetStoreAPITest >> controllersToInstall [ ^ {petsController. ordersController} ] -{ #category : #private } +{ #category : 'private' } PetStoreAPITest >> port [ ^ 65535 ] -{ #category : #running } +{ #category : 'running' } PetStoreAPITest >> setUpAPI [ petsController := PetsRESTfulController new. @@ -40,7 +42,7 @@ PetStoreAPITest >> setUpAPI [ super setUpAPI ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testBadRequest [ self @@ -54,7 +56,7 @@ PetStoreAPITest >> testBadRequest [ withExceptionDo: [ :error | self assert: error response isBadRequest ] ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } PetStoreAPITest >> testCORSAllowingAnyOrigin [ | response | @@ -86,7 +88,7 @@ PetStoreAPITest >> testCORSAllowingAnyOrigin [ assert: ( response headers at: 'Access-Control-Allow-Origin' ) equals: '*' ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } PetStoreAPITest >> testCORSAllowingExactlyOneOrigin [ | response | @@ -120,7 +122,7 @@ PetStoreAPITest >> testCORSAllowingExactlyOneOrigin [ assert: response canBeSharedWithRequestsFrom: self baseUrl ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } PetStoreAPITest >> testCORSAllowingMoreThanOneOrigin [ | response | @@ -160,7 +162,7 @@ PetStoreAPITest >> testCORSAllowingMoreThanOneOrigin [ assert: response canBeSharedWithRequestsFrom: self baseUrl ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } PetStoreAPITest >> testCORSOptionalHeaders [ | response | @@ -209,7 +211,7 @@ PetStoreAPITest >> testCORSOptionalHeaders [ deny: response varyHeaderNames includes: 'Access-Control-Allow-Headers' ] -{ #category : #'tests - CORS' } +{ #category : 'tests - CORS' } PetStoreAPITest >> testCORSRespondWithEmptyHeadersIfOriginNotAllowed [ | response | @@ -240,7 +242,7 @@ PetStoreAPITest >> testCORSRespondWithEmptyHeadersIfOriginNotAllowed [ should: [ response headers at: 'Access-Control-Allow-Origin' ] raise: KeyNotFound ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testConflict [ self newClient @@ -268,7 +270,7 @@ PetStoreAPITest >> testConflict [ ] ] -{ #category : #tests } +{ #category : 'tests' } PetStoreAPITest >> testCreatePet [ | response json | @@ -296,7 +298,7 @@ PetStoreAPITest >> testCreatePet [ assert: json selfLocation equals: response location ] -{ #category : #tests } +{ #category : 'tests' } PetStoreAPITest >> testGetPets [ | json | @@ -308,7 +310,7 @@ PetStoreAPITest >> testGetPets [ assert: json links size equals: 1 ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testMethodNotAllowed [ self newClient @@ -329,7 +331,7 @@ PetStoreAPITest >> testMethodNotAllowed [ ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testNotAcceptable [ self @@ -343,7 +345,7 @@ PetStoreAPITest >> testNotAcceptable [ assert: error response hasEntity ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testNotFound [ self @@ -352,7 +354,7 @@ PetStoreAPITest >> testNotFound [ withExceptionDo: [ :error | self assert: error response isNotFound ] ] -{ #category : #'tests - client errors' } +{ #category : 'tests - client errors' } PetStoreAPITest >> testUnsupportedMediaType [ self diff --git a/source/Stargate-Examples-Tests/PetsRESTfulControllerTest.class.st b/source/Stargate-Examples-Tests/PetsRESTfulControllerTest.class.st index e484596..522529b 100644 --- a/source/Stargate-Examples-Tests/PetsRESTfulControllerTest.class.st +++ b/source/Stargate-Examples-Tests/PetsRESTfulControllerTest.class.st @@ -2,27 +2,29 @@ I'm a user stoty test testing the service providing the Pet resource, in the classic Pet Store example " Class { - #name : #PetsRESTfulControllerTest, - #superclass : #SingleResourceRESTfulControllerTest, + #name : 'PetsRESTfulControllerTest', + #superclass : 'SingleResourceRESTfulControllerTest', #instVars : [ 'petRepository' ], - #category : #'Stargate-Examples-Tests-PetStore' + #category : 'Stargate-Examples-Tests-PetStore', + #package : 'Stargate-Examples-Tests', + #tag : 'PetStore' } -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> assert: anObject equals: aSecondObject or: aThirdObject [ self assert: ( anObject = aSecondObject or: [ anObject = aThirdObject ] ) ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> baseUrl [ ^ 'https://pets.example.com' asUrl ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> createPet [ self @@ -32,7 +34,7 @@ PetsRESTfulControllerTest >> createPet [ within: self newHttpRequestContext) isSuccess ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> createSixPets [ resourceController @@ -46,13 +48,13 @@ PetsRESTfulControllerTest >> createSixPets [ self assert: petRepository count equals: 6 ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> defaultPetMediaType [ ^ resourceController petVersion1dot0dot0MediaType ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> entityTagOfPetIdentifiedBy: anIdentifier [ | getResponse | @@ -64,7 +66,7 @@ PetsRESTfulControllerTest >> entityTagOfPetIdentifiedBy: anIdentifier [ ^ getResponse entityTag ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestMissingIfMatchHeaderToUpdatePetIdentifiedBy: anIdentifier nameTo: aName [ ^ TeaRequest @@ -76,25 +78,25 @@ PetsRESTfulControllerTest >> requestMissingIfMatchHeaderToUpdatePetIdentifiedBy: pathParams: ( self parametersWith: anIdentifier ) ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestToCreatePetFrom: json [ ^ self requestToPOST: json as: self defaultPetMediaType ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestToGetPetsAccepting: anAcceptHeader [ ^ self requestToGET: self resourceUrl accepting: anAcceptHeader ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestToUpdatePetIdentifiedBy: anIdentifier nameTo: aName [ ^ self requestToUpdatePetIdentifiedBy: anIdentifier nameTo: aName using: (self entityTagOfPetIdentifiedBy: anIdentifier) ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestToUpdatePetIdentifiedBy: anIdentifier nameTo: aName using: anETag [ ^ self @@ -104,7 +106,7 @@ PetsRESTfulControllerTest >> requestToUpdatePetIdentifiedBy: anIdentifier nameTo conditionalTo: anETag ] -{ #category : #'private - support' } +{ #category : 'private - support' } PetsRESTfulControllerTest >> requestToUpdatePetIdentifiedBy: anIdentifier statusTo: aStatus [ ^ self @@ -114,7 +116,7 @@ PetsRESTfulControllerTest >> requestToUpdatePetIdentifiedBy: anIdentifier status conditionalTo: ( self entityTagOfPetIdentifiedBy: anIdentifier ) ] -{ #category : #running } +{ #category : 'running' } PetsRESTfulControllerTest >> setUp [ petRepository := InMemoryPetRepository new. @@ -122,13 +124,13 @@ PetsRESTfulControllerTest >> setUp [ self assert: petRepository findAll isEmpty ] -{ #category : #running } +{ #category : 'running' } PetsRESTfulControllerTest >> setUpResourceController [ resourceController := PetsRESTfulController persistingTo: petRepository ] -{ #category : #'tests - delete' } +{ #category : 'tests - delete' } PetsRESTfulControllerTest >> testCantDeleteInvalidPet [ self @@ -137,7 +139,7 @@ PetsRESTfulControllerTest >> testCantDeleteInvalidPet [ withExceptionDo: [ :signal | self assert: signal code equals: 404 ] ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testCantGetPetSpecifyingLanguageRange [ self @@ -165,7 +167,7 @@ PetsRESTfulControllerTest >> testCantGetPetSpecifyingLanguageRange [ ] ] -{ #category : #'tests - update' } +{ #category : 'tests - update' } PetsRESTfulControllerTest >> testCantUpdatePetIfMissingETag [ self @@ -175,7 +177,7 @@ PetsRESTfulControllerTest >> testCantUpdatePetIfMissingETag [ withExceptionDo: [ :error | self assert: error code equals: 428 ] ] -{ #category : #'tests - update' } +{ #category : 'tests - update' } PetsRESTfulControllerTest >> testCantUpdatePetNameWhenEmpty [ self @@ -191,7 +193,7 @@ PetsRESTfulControllerTest >> testCantUpdatePetNameWhenEmpty [ raise: HTTPClientError unprocessableEntity ] -{ #category : #'tests - update' } +{ #category : 'tests - update' } PetsRESTfulControllerTest >> testCantUpdatePetWhenETagDoesNotMatch [ self @@ -201,7 +203,7 @@ PetsRESTfulControllerTest >> testCantUpdatePetWhenETagDoesNotMatch [ withExceptionDo: [ :error | self assert: error code equals: 412 ] ] -{ #category : #'tests - get collection' } +{ #category : 'tests - get collection' } PetsRESTfulControllerTest >> testComplexPagination [ | response | @@ -259,7 +261,7 @@ PetsRESTfulControllerTest >> testComplexPagination [ ] ] -{ #category : #'tests - delete' } +{ #category : 'tests - delete' } PetsRESTfulControllerTest >> testDeletePet [ | response | @@ -274,7 +276,7 @@ PetsRESTfulControllerTest >> testDeletePet [ deny: response hasEntity ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testGetNotModifiedWhenValidETag [ | response | @@ -302,7 +304,7 @@ PetsRESTfulControllerTest >> testGetNotModifiedWhenValidETag [ assert: response entityTag equals: '"c051344b8c92c5ed8a2bd0752070c35ed3de3bab"' asEntityTag ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testGetPetJustCreated [ | response | @@ -335,7 +337,7 @@ PetsRESTfulControllerTest >> testGetPetJustCreated [ ] ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testGetPetJustCreatedWhenNoAcceptHeaderPresentInRequest [ | getRequest response | @@ -371,7 +373,7 @@ PetsRESTfulControllerTest >> testGetPetJustCreatedWhenNoAcceptHeaderPresentInReq ] ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testGetPetNotFoundShouldFail [ self @@ -383,7 +385,7 @@ PetsRESTfulControllerTest >> testGetPetNotFoundShouldFail [ withExceptionDo: [ :error | self assert: error code equals: 404 ] ] -{ #category : #'tests - get individual' } +{ #category : 'tests - get individual' } PetsRESTfulControllerTest >> testGetPetSummaryJustCreated [ | response | @@ -418,7 +420,7 @@ PetsRESTfulControllerTest >> testGetPetSummaryJustCreated [ ] ] -{ #category : #'tests - get collection' } +{ #category : 'tests - get collection' } PetsRESTfulControllerTest >> testGetPets [ | response | @@ -444,7 +446,7 @@ PetsRESTfulControllerTest >> testGetPets [ ] ] -{ #category : #'tests - get collection' } +{ #category : 'tests - get collection' } PetsRESTfulControllerTest >> testGetPetsNotEmpty [ | response | @@ -483,7 +485,7 @@ PetsRESTfulControllerTest >> testGetPetsNotEmpty [ ] ] -{ #category : #'tests - get collection' } +{ #category : 'tests - get collection' } PetsRESTfulControllerTest >> testGetPetsNotEmptyAcceptingCompleteMediaType [ | response | @@ -522,7 +524,7 @@ PetsRESTfulControllerTest >> testGetPetsNotEmptyAcceptingCompleteMediaType [ ] ] -{ #category : #'tests - get collection' } +{ #category : 'tests - get collection' } PetsRESTfulControllerTest >> testGetPetsWithPagination [ | response | @@ -579,7 +581,7 @@ PetsRESTfulControllerTest >> testGetPetsWithPagination [ ] ] -{ #category : #'tests - creation' } +{ #category : 'tests - creation' } PetsRESTfulControllerTest >> testPetCreation [ | response request | @@ -599,7 +601,7 @@ PetsRESTfulControllerTest >> testPetCreation [ assert: petRepository findAll first name equals: 'Firulais' ] -{ #category : #'tests - creation' } +{ #category : 'tests - creation' } PetsRESTfulControllerTest >> testPetCreationWhenNoAcceptHeaderPresentInRequest [ | request response | @@ -624,13 +626,13 @@ PetsRESTfulControllerTest >> testPetCreationWhenNoAcceptHeaderPresentInRequest [ assert: petRepository findAll first name equals: 'Firulais' ] -{ #category : #tests } +{ #category : 'tests' } PetsRESTfulControllerTest >> testTemplate [ self assert: resourceController identifierTemplate equals: '/pets/' ] -{ #category : #'tests - update' } +{ #category : 'tests - update' } PetsRESTfulControllerTest >> testUpdatePetName [ | response | @@ -657,7 +659,7 @@ PetsRESTfulControllerTest >> testUpdatePetName [ assertUrl: json selfLocation equals: 'https://pets.example.com/pets/1' ] ] -{ #category : #'tests - update' } +{ #category : 'tests - update' } PetsRESTfulControllerTest >> testUpdatePetStatus [ | response | diff --git a/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st b/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st index a8da197..03f64bf 100644 --- a/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st +++ b/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st @@ -2,60 +2,62 @@ A SouthAmericanCurrenciesRESTfulControllerTest is a test class for testing the behavior of SouthAmericanCurrenciesRESTfulController " Class { - #name : #SouthAmericanCurrenciesRESTfulControllerTest, - #superclass : #SingleResourceRESTfulControllerTest, - #category : #'Stargate-Examples-Tests-Currencies' + #name : 'SouthAmericanCurrenciesRESTfulControllerTest', + #superclass : 'SingleResourceRESTfulControllerTest', + #category : 'Stargate-Examples-Tests-Currencies', + #package : 'Stargate-Examples-Tests', + #tag : 'Currencies' } -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> argentineSpanish [ ^ 'es-AR' asLanguageTag ] -{ #category : #'private - support' } +{ #category : 'private - support' } SouthAmericanCurrenciesRESTfulControllerTest >> assertThereAreNoLinksIn: json [ self assert: json links isNil ] -{ #category : #'private - support' } +{ #category : 'private - support' } SouthAmericanCurrenciesRESTfulControllerTest >> baseUrl [ ^ 'https://currencies.example.com' asUrl ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> english [ ^ 'en' asLanguageTag ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> languageRange [ ^ 'de,en;q=0.5,es;q=0.6' ] -{ #category : #running } +{ #category : 'running' } SouthAmericanCurrenciesRESTfulControllerTest >> setUpResourceController [ resourceController := SouthAmericanCurrenciesRESTfulController new ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> spanish [ ^ 'es' asLanguageTag ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> supportedLanguages [ ^ Array with: self argentineSpanish with: self unitedStatesEnglish ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testCantGetArgentinePesoAskingForAnEmptyLanguage [ | request | @@ -77,7 +79,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testCantGetArgentinePesoAskingFo ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testCantGetArgentinePesoAskingForUnsupportedLanguage [ | request | @@ -99,7 +101,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testCantGetArgentinePesoAskingFo ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePeso [ | response | @@ -130,7 +132,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePeso [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoBanknotes [ | response | @@ -155,7 +157,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoBanknotes [ self assertCollection: banknotes hasSameElements: #( 5 10 20 50 100 200 500 1000 ) ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInEnglish [ | response request | @@ -187,7 +189,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInEnglish [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInEnglishBasedOnAnyLanguageWildcard [ | response request | @@ -219,7 +221,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInEnglishBas ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInSpanish [ | response request | @@ -251,7 +253,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInSpanish [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInSpanishBasedOnLanguagePriorityList [ | response request | @@ -283,7 +285,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetArgentinePesoInSpanishBas ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianReal [ | response | @@ -313,7 +315,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianReal [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianRealInEnglish [ | response request | @@ -346,7 +348,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianRealInEnglish [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianRealInSpanish [ | response request | @@ -378,7 +380,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetBrazilianRealInSpanish [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrencies [ | response | @@ -407,7 +409,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrencies [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrenciesInSpanish [ | response request | @@ -440,7 +442,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrenciesInSpanish [ ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrencyNotFoundShouldFail [ self @@ -453,7 +455,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrencyNotFoundShouldFai withExceptionDo: [ :error | self assert: error code equals: 404 ] ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testGetNotModifiedWhenValidETag [ | response | @@ -466,7 +468,10 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetNotModifiedWhenValidETag self assert: response isSuccess; - assert: response entityTag equals: '"5dd07a40a75ea23fa44e641a92a6dd1ec7999a36"' asEntityTag. + assert: response entityTag equals: '"5dd07a40a75ea23fa44e641a92a6dd1ec7999a36"' asEntityTag; + assert: response cachingDirectives size equals: 2; + assert: response cachingDirectives includes: 'immutable'; + assert: response cachingDirectives includes: 'public'. response := resourceController currencyBasedOn: ( self @@ -478,10 +483,13 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetNotModifiedWhenValidETag self assert: response code equals: 304; assert: response entityTag equals: '"5dd07a40a75ea23fa44e641a92a6dd1ec7999a36"' asEntityTag; - assert: response varyHeaderNames includes: 'Accept' + assert: response varyHeaderNames includes: 'Accept'; + assert: response cachingDirectives size equals: 2; + assert: response cachingDirectives includes: 'immutable'; + assert: response cachingDirectives includes: 'public' ] -{ #category : #tests } +{ #category : 'tests' } SouthAmericanCurrenciesRESTfulControllerTest >> testTemplates [ | routes | @@ -496,13 +504,13 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testTemplates [ routes do: [ :route | self assert: route httpMethod equals: #GET ] ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> unitedStatesEnglish [ ^ 'en-US' asLanguageTag ] -{ #category : #'private - language ranges' } +{ #category : 'private - language ranges' } SouthAmericanCurrenciesRESTfulControllerTest >> unsupportedLanguage [ ^ 'de' asLanguageTag diff --git a/source/Stargate-Examples-Tests/package.st b/source/Stargate-Examples-Tests/package.st index f9339ec..ab5698e 100644 --- a/source/Stargate-Examples-Tests/package.st +++ b/source/Stargate-Examples-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Stargate-Examples-Tests' } +Package { #name : 'Stargate-Examples-Tests' } From 767df30e3f3ecd174e33ce50d6c9c19ed79d5d68 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Tue, 21 Nov 2023 16:25:55 -0300 Subject: [PATCH 2/2] Fix tests broken do to NeoJSON updates --- ...icationConfigurationPluginAPITest.class.st | 21 +++++++++-------- ...urationPluginConfigurationAPITest.class.st | 13 ++++++----- ...pplicationConfigurationPluginTest.class.st | 21 +++++++++-------- ...onfigurationRESTfulControllerTest.class.st | 23 ++++++++++--------- .../package.st | 2 +- .../PetOrdersRESTfulControllerTest.class.st | 2 +- ...anCurrenciesRESTfulControllerTest.class.st | 12 ++++++---- 7 files changed, 50 insertions(+), 44 deletions(-) diff --git a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginAPITest.class.st b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginAPITest.class.st index 8de39ec..59688fc 100644 --- a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginAPITest.class.st +++ b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginAPITest.class.st @@ -2,18 +2,19 @@ I'm the test case for the Application Configuration API " Class { - #name : #ApplicationConfigurationPluginAPITest, - #superclass : #OperationalPluginAPITest, - #category : #'Stargate-Application-Configuration-Tests' + #name : 'ApplicationConfigurationPluginAPITest', + #superclass : 'OperationalPluginAPITest', + #category : 'Stargate-Application-Configuration-Tests', + #package : 'Stargate-Application-Configuration-Tests' } -{ #category : #private } +{ #category : 'private' } ApplicationConfigurationPluginAPITest >> configurationParameters [ ^ Array with: ( MandatoryConfigurationParameter named: 'Public URL' describedBy: 'Public URL' ) ] -{ #category : #private } +{ #category : 'private' } ApplicationConfigurationPluginAPITest >> configurationProvider [ ^ [ @@ -23,7 +24,7 @@ ApplicationConfigurationPluginAPITest >> configurationProvider [ ] ] -{ #category : #running } +{ #category : 'running' } ApplicationConfigurationPluginAPITest >> operationsConfiguration [ ^ super operationsConfiguration @@ -36,13 +37,13 @@ ApplicationConfigurationPluginAPITest >> operationsConfiguration [ yourself ] -{ #category : #private } +{ #category : 'private' } ApplicationConfigurationPluginAPITest >> requiredPermissions [ ^ #('read:application-configuration') ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginAPITest >> testDisablePlugin [ self assertIsEnabled: ApplicationConfigurationPlugin. @@ -62,7 +63,7 @@ ApplicationConfigurationPluginAPITest >> testDisablePlugin [ withExceptionDo: [ :error | self assert: error response isNotFound ] ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginAPITest >> testEnablePreviouslyDisabledPlugin [ self assertIsEnabled: ApplicationConfigurationPlugin. @@ -76,7 +77,7 @@ ApplicationConfigurationPluginAPITest >> testEnablePreviouslyDisabledPlugin [ self testGetConfigurationWithPermissions ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginAPITest >> testGetConfigurationWithPermissions [ | response | diff --git a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginConfigurationAPITest.class.st b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginConfigurationAPITest.class.st index aba44e6..65dc2a5 100644 --- a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginConfigurationAPITest.class.st +++ b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginConfigurationAPITest.class.st @@ -2,12 +2,13 @@ I'm a test for API configuration options " Class { - #name : #ApplicationConfigurationPluginConfigurationAPITest, - #superclass : #OperationalPluginAPITest, - #category : #'Stargate-Application-Configuration-Tests' + #name : 'ApplicationConfigurationPluginConfigurationAPITest', + #superclass : 'OperationalPluginAPITest', + #category : 'Stargate-Application-Configuration-Tests', + #package : 'Stargate-Application-Configuration-Tests' } -{ #category : #running } +{ #category : 'running' } ApplicationConfigurationPluginConfigurationAPITest >> operationsConfiguration [ ^ super operationsConfiguration @@ -15,13 +16,13 @@ ApplicationConfigurationPluginConfigurationAPITest >> operationsConfiguration [ yourself ] -{ #category : #private } +{ #category : 'private' } ApplicationConfigurationPluginConfigurationAPITest >> requiredPermissions [ ^ #('read:application-configuration') ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginConfigurationAPITest >> testPluginIsDisabled [ self diff --git a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginTest.class.st b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginTest.class.st index cf77d7f..0d4feba 100644 --- a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginTest.class.st +++ b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationPluginTest.class.st @@ -2,12 +2,13 @@ An ApplicationConfigurationPluginTest is a test class for testing the behavior of ApplicationConfigurationPlugin " Class { - #name : #ApplicationConfigurationPluginTest, - #superclass : #TestCase, - #category : #'Stargate-Application-Configuration-Tests' + #name : 'ApplicationConfigurationPluginTest', + #superclass : 'TestCase', + #category : 'Stargate-Application-Configuration-Tests', + #package : 'Stargate-Application-Configuration-Tests' } -{ #category : #accessing } +{ #category : 'accessing' } ApplicationConfigurationPluginTest >> configuration [ ^ Dictionary new @@ -20,7 +21,7 @@ ApplicationConfigurationPluginTest >> configuration [ yourself ] -{ #category : #accessing } +{ #category : 'accessing' } ApplicationConfigurationPluginTest >> configurationParameters [ ^ Array @@ -35,7 +36,7 @@ ApplicationConfigurationPluginTest >> configurationParameters [ convertingWith: [ :value | value = 'true' ] ) ] -{ #category : #accessing } +{ #category : 'accessing' } ApplicationConfigurationPluginTest >> configurationProvider [ ^ [ @@ -46,7 +47,7 @@ ApplicationConfigurationPluginTest >> configurationProvider [ ] ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginTest >> testConfigurationAccessing [ | plugin parameter | @@ -74,19 +75,19 @@ ApplicationConfigurationPluginTest >> testConfigurationAccessing [ assert: ( plugin currentValueFor: parameter ) ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginTest >> testEnabledByDefault [ self deny: ApplicationConfigurationPlugin enabledByDefault ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginTest >> testEndpoint [ self assert: ApplicationConfigurationPlugin endpoint equals: 'application-configuration' ] -{ #category : #tests } +{ #category : 'tests' } ApplicationConfigurationPluginTest >> testPluginName [ self assert: ApplicationConfigurationPlugin pluginName equals: 'Application Configuration' diff --git a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationRESTfulControllerTest.class.st b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationRESTfulControllerTest.class.st index d357db8..7a4eb8f 100644 --- a/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationRESTfulControllerTest.class.st +++ b/source/Stargate-Application-Configuration-Tests/ApplicationConfigurationRESTfulControllerTest.class.st @@ -2,12 +2,13 @@ An ApplicationConfigurationRESTfulControllerTest is a test class for testing the behavior of ApplicationConfigurationRESTfulController " Class { - #name : #ApplicationConfigurationRESTfulControllerTest, - #superclass : #OperationalPluginRESTfulControllerTest, - #category : #'Stargate-Application-Configuration-Tests' + #name : 'ApplicationConfigurationRESTfulControllerTest', + #superclass : 'OperationalPluginRESTfulControllerTest', + #category : 'Stargate-Application-Configuration-Tests', + #package : 'Stargate-Application-Configuration-Tests' } -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> configurationParameters [ ^ Array @@ -25,7 +26,7 @@ ApplicationConfigurationRESTfulControllerTest >> configurationParameters [ asSensitive ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> configurationProvider [ ^ [ @@ -36,7 +37,7 @@ ApplicationConfigurationRESTfulControllerTest >> configurationProvider [ ] ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> operationsConfiguration [ ^ super operationsConfiguration @@ -49,7 +50,7 @@ ApplicationConfigurationRESTfulControllerTest >> operationsConfiguration [ yourself ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> setUpResourceController [ resourceController := ApplicationConfigurationRESTfulController @@ -57,7 +58,7 @@ ApplicationConfigurationRESTfulControllerTest >> setUpResourceController [ configuredBy: self operationsConfiguration ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> testGetConfigurationInJson [ | response | @@ -112,13 +113,13 @@ ApplicationConfigurationRESTfulControllerTest >> testGetConfigurationInJson [ assert: config attributeName equals: 'secret'; assert: config commandLineArgumentName equals: 'vault.secret'; assert: config environmentVariableName equals: 'VAULT__SECRET'; - assert: config sections equals: #( 'Vault' ); + assert: config sections hasTheSameElementsInTheSameOrderThat: #( 'Vault' ); assert: ( config at: #'current-value' ) equals: '**********' ] ] ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> testGetConfigurationInPlainText [ | response | @@ -137,7 +138,7 @@ ApplicationConfigurationRESTfulControllerTest >> testGetConfigurationInPlainText with: String lf ) ] -{ #category : #'private - support' } +{ #category : 'private - support' } ApplicationConfigurationRESTfulControllerTest >> withConfigurationNamed: aName in: configurations do: aBlock [ configurations detect: [ :config | config name = aName ] ifFound: aBlock ifNone: [ self fail ] diff --git a/source/Stargate-Application-Configuration-Tests/package.st b/source/Stargate-Application-Configuration-Tests/package.st index 4e831c9..a0f2c96 100644 --- a/source/Stargate-Application-Configuration-Tests/package.st +++ b/source/Stargate-Application-Configuration-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Stargate-Application-Configuration-Tests' } +Package { #name : 'Stargate-Application-Configuration-Tests' } diff --git a/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st b/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st index b931940..9f4f3bc 100644 --- a/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st +++ b/source/Stargate-Examples-Tests/PetOrdersRESTfulControllerTest.class.st @@ -593,5 +593,5 @@ PetOrdersRESTfulControllerTest >> testUpdateCommentAcceptingADifferentMediaType assert: response isSuccess; assert: response contentType equals: ZnMimeType applicationJson; withJsonFromContentsIn: response - do: [ :json | self assert: json equals: #( 'Hola!' 'Mr. DJ' ) ] ] + do: [ :json | self assert: json hasTheSameElementsInTheSameOrderThat: #( 'Hola!' 'Mr. DJ' ) ] ] ] diff --git a/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st b/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st index 03f64bf..ced337f 100644 --- a/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st +++ b/source/Stargate-Examples-Tests/SouthAmericanCurrenciesRESTfulControllerTest.class.st @@ -401,11 +401,12 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrencies [ assert: response varyHeaderNames includes: 'Accept'. self assertCachingDirectivesFor: response with: #( 'immutable' 'Max-Age=86400' ). - self withJsonFromContentsIn: response do: [ :currencies | + self withJsonFromContentsIn: response do: [ :currencies | self assert: currencies size equals: 11; assert: ( currencies collect: #isoCode ) - equals: #( 'ARS' 'BOB' 'BRL' 'CLP' 'COP' 'GYD' 'PYG' 'PEN' 'SRD' 'UYU' 'VES' ) + hasTheSameElementsInTheSameOrderThat: + #( 'ARS' 'BOB' 'BRL' 'CLP' 'COP' 'GYD' 'PYG' 'PEN' 'SRD' 'UYU' 'VES' ) ] ] @@ -414,7 +415,7 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrenciesInSpanish [ | response request | - request := self requestToGET: self resourceUrl applying: [ :requestConfig | + request := self requestToGET: self resourceUrl applying: [ :requestConfig | requestConfig setAccept: resourceController currencyVersion1dot0dot0MediaType; setAcceptLanguage: self spanish @@ -433,11 +434,12 @@ SouthAmericanCurrenciesRESTfulControllerTest >> testGetCurrenciesInSpanish [ assert: response varyHeaderNames includes: 'Accept'. self assertCachingDirectivesFor: response with: #( 'immutable' 'Max-Age=86400' ). - self withJsonFromContentsIn: response do: [ :currencies | + self withJsonFromContentsIn: response do: [ :currencies | self assert: currencies size equals: 11; assert: ( currencies collect: #isoCode ) - equals: #( 'ARS' 'BOB' 'BRL' 'CLP' 'COP' 'GYD' 'PYG' 'PEN' 'SRD' 'UYU' 'VES' ); + hasTheSameElementsInTheSameOrderThat: + #( 'ARS' 'BOB' 'BRL' 'CLP' 'COP' 'GYD' 'PYG' 'PEN' 'SRD' 'UYU' 'VES' ); assert: ( currencies anySatisfy: [ :currency | currency name = 'Real brasileƱo' ] ) ] ]