-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vincent Eichhorn
committed
Jun 20, 2024
1 parent
f8b8fa4
commit cb55912
Showing
2 changed files
with
73 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Class { | ||
#name : #SPOCTestAuthorizerProcess, | ||
#superclass : #SPOCTestCaseWithAuth, | ||
#category : #'SpotifyConnect-Auth-Tests' | ||
} | ||
|
||
{ | ||
#category : #'as yet unclassified', | ||
#'squeak_changestamp' : 'VE 6/20/2024 19:56' | ||
} | ||
SPOCTestAuthorizerProcess >> testAuthorizationUrl [ | ||
|
||
| targetUrl url | | ||
url := self auth buildAuthorizationUrl. | ||
targetUrl := 'https://accounts.spotify.com/authorize', | ||
'?response_type=code', | ||
'&scope=', SPOCAuthorizer scope, | ||
'&redirect_uri=', SPOCAuthorizer redirectUri, | ||
'&state=', self auth randomState, | ||
'&client_id=', SPOCAuthorizer clientId. | ||
self assert: targetUrl = url. | ||
] | ||
|
||
{ | ||
#category : #'as yet unclassified', | ||
#'squeak_changestamp' : 'VE 6/20/2024 19:54' | ||
} | ||
SPOCTestAuthorizerProcess >> testCallbackEndpoint [ | ||
|
||
| response | | ||
response := WebClient httpGet: SPOCAuthorizer redirectUri. | ||
self assert: (response code = 404) not | ||
] | ||
|
||
{ | ||
#category : #'as yet unclassified', | ||
#'squeak_changestamp' : 'VE 6/20/2024 19:54' | ||
} | ||
SPOCTestAuthorizerProcess >> testCallbackErrors [ | ||
|
||
| response | | ||
response := WebClient httpGet: (SPOCAuthorizer redirectUri, '?code=123'). | ||
self assert: response code = 400. | ||
response := WebClient httpGet: (SPOCAuthorizer redirectUri, '?state=123'). | ||
self assert: response code = 400. | ||
response := WebClient httpGet: (SPOCAuthorizer redirectUri, '?error=error'). | ||
self assert: response code = 500 | ||
] |