Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/api-tests
diff options
context:
space:
mode:
authorLeitwolf112026-10-16 07:16:14 +0300
committerLeitwolf112026-10-16 07:16:14 +0300
commit235874b4e2bbf75acf2fd09ec37c3dfd480c01b7 (patch)
treec76322adffc6f0a794cfe7391de8d32ece8b57ae /apps/api-tests
parent205d91185e22b9129c528296cf07d15225d82866 (diff)
parente140d6587a1a74efc205b29582dfbe9942e0f3dc (diff)
downloadprogmaweb-235874b4e2bbf75acf2fd09ec37c3dfd480c01b7.tar.gz
Merge remote-tracking branch 'origin/main' into feature/thirty-day-sessions
Diffstat (limited to 'apps/api-tests')
-rw-r--r--apps/api-tests/AccountEndpointTests.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/api-tests/AccountEndpointTests.cs b/apps/api-tests/AccountEndpointTests.cs
index 9459081..c5c305e 100644
--- a/apps/api-tests/AccountEndpointTests.cs
+++ b/apps/api-tests/AccountEndpointTests.cs
@@ -33,6 +33,21 @@ public sealed class AccountEndpointTests
Assert.Contains("state=", location.Query, StringComparison.Ordinal);
}
+ [Theory]
+ [InlineData("/api/v1/accounts/oauth/google/callback")]
+ [InlineData("/api/v1/accounts/oauth/google/callback?error=access_denied&state=declined")]
+ [InlineData("/api/v1/accounts/oauth/google/callback?code=forged&state=forged")]
+ public async Task GoogleCallbackThatCannotFinishReturnsToTheSignInPage(string callback)
+ {
+ await using AccountApiFactory factory = new();
+ using HttpClient client = factory.CreateAccountClient(handleCookies: false);
+
+ HttpResponseMessage response = await client.GetAsync(callback, TestContext.Current.CancellationToken);
+
+ Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
+ Assert.Equal("/login?google=failed", response.Headers.Location?.OriginalString);
+ }
+
[Fact]
public async Task GoogleStartRejectsInvalidAccountNameBeforeLeavingTheSite()
{