Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria committed Feb 17, 2025
1 parent 4dedc4a commit 9afb01f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/Metadata/Cache/RouteCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function __construct()
'api/v2/Map' => new RouteCacheConfig(tag: CacheTag::GALLERY, user_dependant: true, extra: [RequestAttribute::ALBUM_ID_ATTRIBUTE]),
'api/v2/Map::provider' => new RouteCacheConfig(tag: CacheTag::SETTINGS),
'api/v2/Oauth' => new RouteCacheConfig(tag: CacheTag::USER, user_dependant: true),
'api/v2/Oauth::providers' => new RouteCacheConfig(tag: CacheTag::SETTINGS),
'api/v2/WebAuthn' => new RouteCacheConfig(tag: CacheTag::USER, user_dependant: true),

// Response must be different for each call.
Expand Down
2 changes: 1 addition & 1 deletion resources/js/services/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Constants from "./constants";

const OauthService = {
listProviders(): Promise<AxiosResponse<App.Enum.OauthProvidersType[]>> {
return axios.get(`${Constants.getApiUrl()}OauthProviders`, { data: {} });
return axios.get(`${Constants.getApiUrl()}Oauth::providers`, { data: {} });
},

list(): Promise<AxiosResponse<App.Http.Resources.Oauth.OauthRegistrationData[]>> {
Expand Down
2 changes: 1 addition & 1 deletion routes/api_v2.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
// This route returns different results depending whether we are authenticated or not:
// If Authenticated: list of the registrated Oauth providers
// If not Authenticated: list of the available Oauth providers
Route::get('/OauthProviders', [OauthController::class, 'listProviders']);
Route::get('/Oauth::providers', [OauthController::class, 'listProviders'])->middleware(['cache_control']);
Route::get('/Oauth', [OauthController::class, 'listForUser']);
Route::delete('/Oauth', [OauthController::class, 'clear']);

Expand Down
4 changes: 2 additions & 2 deletions tests/Feature_v2/Oauth/OauthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testGetAnonymous(): void
Config::set('services.github.client_secret', 'something');
Config::set('services.github.redirect', 'something');

$response = $this->getJson('OauthProviders');
$response = $this->getJson('Oauth::providers');
$this->assertOk($response);
$response->assertJson(['github']);

Expand All @@ -46,7 +46,7 @@ public function testUser(): void
Config::set('services.github.client_secret', 'something');
Config::set('services.github.redirect', 'something');

$response = $this->actingAs($this->userMayUpload1)->getJson('OauthProviders');
$response = $this->actingAs($this->userMayUpload1)->getJson('Oauth::providers');
$this->assertOk($response);
$response->assertJson(['github']);

Expand Down

0 comments on commit 9afb01f

Please sign in to comment.