Skip to content

Commit

Permalink
Fix tests in GS64
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Sep 26, 2023
1 parent d7e5d9b commit a62dd66
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ StargateApplicationTest class >> defaultTimeLimit [
^5 minute
]

{ #category : #private }
StargateApplicationTest >> assert: string isLineEndingInsensitiveEqualsTo: anotherString [

self
assert: ( string withLineEndings: String lf )
equals: ( anotherString withLineEndings: String lf )
]

{ #category : #private }
StargateApplicationTest >> baseUrl [

Expand Down Expand Up @@ -275,7 +283,7 @@ StargateApplicationTest >> testPrintHelpOn [

help := String streamContents: [ :stream | PetStoreApplication printHelpOn: stream ].

self assert: help equals: ('NAME
self assert: help isLineEndingInsensitiveEqualsTo: ('NAME
pet-store [<1s>] - A RESTful API for Pet stores
SYNOPSYS
pet-store --pet-store.stargate.public-url=%<publicURL%> --pet-store.stargate.port=%<port%> --pet-store.stargate.operations-secret=%<operationsSecret%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ JWTBearerAuthenticationFilterTest >> testInvalidCredentials [
filter := self newFilter.

self
assertResponseFor: ( self newHttpRequestWithJWTBearerAuthenticationFor: '' )
assertResponseFor: ( self newHttpRequestWithJWTBearerAuthenticationFor: 'notasecret' )
isUnauthorizedAfterApplying: filter.

self
Expand Down
27 changes: 16 additions & 11 deletions source/Stargate-Model/QualifiedLanguageRange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ Class {
QualifiedLanguageRange class >> fromString: aString [

^ ( aString substrings: ';' )
ifEmpty: [ InstanceCreationFailed signal: 'Cannot create a qualified language range with an empty string' ]
ifNotEmpty: [ :tokens |
| quality languageRange |

languageRange := LanguageRange fromString: tokens first trimBoth.
quality := tokens withoutFirst
detect: [ :parameter | parameter beginsWith: 'q=' ]
ifFound: [ :qParameter | ( qParameter withoutFirst: 2 ) asNumber ]
ifNone: [ 1.0 ].
self qualifying: languageRange with: quality
]
ifEmpty: [
InstanceCreationFailed signal: 'Cannot create a qualified language range with an empty string' ]
ifNotEmpty: [ :tokens |
| quality languageRange |

languageRange := LanguageRange fromString: tokens first trimBoth.
quality := tokens withoutFirst
detect: [ :parameter | parameter beginsWith: 'q=' ]
ifFound: [ :qParameter |
( qParameter withoutFirst: 2 )
ifEmpty: [ InstanceCreationFailed signal: 'Invalid quality parameter value' ]
ifNotEmpty: [ :qValue | qValue asNumber ]
]
ifNone: [ 1.0 ].
self qualifying: languageRange with: quality
]
]

{ #category : #'instance creation' }
Expand Down
6 changes: 6 additions & 0 deletions source/Stargate-Model/WebOrigin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ WebOrigin >> = aWebOrigin [
^ self asString = aWebOrigin asString
]

{ #category : #converting }
WebOrigin >> asString [

^ self printString
]

{ #category : #converting }
WebOrigin >> asUrl [

Expand Down

0 comments on commit a62dd66

Please sign in to comment.