Skip to content

Commit

Permalink
Merge pull request #167 from maximo-torterolo-ambrosini/header-config…
Browse files Browse the repository at this point in the history
…-for-tests

Add configuration via block in http support requestToGET
  • Loading branch information
fortizpenaloza committed Jun 5, 2023
2 parents d5260c0 + d188b7d commit 8dba835
Show file tree
Hide file tree
Showing 3 changed files with 327 additions and 140 deletions.
28 changes: 28 additions & 0 deletions source/Stargate-Examples-Tests/PetsRESTfulControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,34 @@ PetsRESTfulControllerTest >> testCantDeleteInvalidPet [
withExceptionDo: [ :signal | self assert: signal code equals: 404 ]
]

{ #category : #'tests - get individual' }
PetsRESTfulControllerTest >> testCantGetPetSpecifyingLanguageRange [

self
assert: ( resourceController
createPetBasedOn: ( self requestToCreatePetFrom: '{"name":"Firulais","type":"dog"}' )
within: self newHttpRequestContext ) isSuccess;
assert: petRepository count equals: 1.

self
should: [
resourceController
getPetBasedOn: ( self
requestToGETResourceIdentifiedBy: 1
acceptingContentMatching: self defaultPetMediaType
inAnyOf: '*' )
within: self newHttpRequestContext
]
raise: HTTPNotAcceptable
withExceptionDo: [ :error |
self
assert: error messageText
equals: 'Cannot generate a response entity with acceptable characteristics.';
assert: error code equals: 406;
assert: error allowedLanguageTags isEmpty
]
]

{ #category : #'tests - update' }
PetsRESTfulControllerTest >> testCantUpdatePetIfMissingETag [

Expand Down
Loading

0 comments on commit 8dba835

Please sign in to comment.