@@ -11,56 +11,21 @@ public sealed class AccountSignupTests
1111 [ ClassDataSource < WebApplicationFactory > ( Shared = SharedType . PerTestSession ) ]
1212 public required WebApplicationFactory WebApplicationFactory { get ; init ; }
1313
14- // --- V1 Signup ---
14+ // --- V1 Signup (retired) ---
1515
1616 [ Test ]
17- public async Task V1Signup_Success_CreatesUser ( )
17+ public async Task V1Signup_Retired_Returns410Gone ( )
1818 {
1919 using var client = WebApplicationFactory . CreateClient ( ) ;
2020
2121 var response = await client . PostAsync ( "/1/account/signup" , TestHelper . JsonContent ( new
2222 {
23- username = "v1user " ,
23+ username = "v1retired " ,
2424 password = "SecurePassword123#" ,
25- email = "v1user @test.org"
25+ email = "v1retired @test.org"
2626 } ) ) ;
2727
28- await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . OK ) ;
29-
30- await using var scope = WebApplicationFactory . Services . CreateAsyncScope ( ) ;
31- var db = scope . ServiceProvider . GetRequiredService < OpenShockContext > ( ) ;
32- var user = await db . Users . FirstOrDefaultAsync ( u => u . Email == "v1user@test.org" ) ;
33- await Assert . That ( user ) . IsNotNull ( ) ;
34- }
35-
36- [ Test , DependsOn ( nameof ( V1Signup_Success_CreatesUser ) ) ]
37- public async Task V1Signup_DuplicateEmail_Returns409 ( )
38- {
39- using var client = WebApplicationFactory . CreateClient ( ) ;
40-
41- var response = await client . PostAsync ( "/1/account/signup" , TestHelper . JsonContent ( new
42- {
43- username = "v1userDifferent" ,
44- password = "SecurePassword123#" ,
45- email = "v1user@test.org" // same email
46- } ) ) ;
47-
48- await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Conflict ) ;
49- }
50-
51- [ Test , DependsOn ( nameof ( V1Signup_Success_CreatesUser ) ) ]
52- public async Task V1Signup_DuplicateUsername_Returns409 ( )
53- {
54- using var client = WebApplicationFactory . CreateClient ( ) ;
55-
56- var response = await client . PostAsync ( "/1/account/signup" , TestHelper . JsonContent ( new
57- {
58- username = "v1user" , // same username
59- password = "SecurePassword123#" ,
60- email = "v1different@test.org"
61- } ) ) ;
62-
63- await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Conflict ) ;
28+ await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Gone ) ;
6429 }
6530
6631 // --- V2 Signup ---
@@ -118,6 +83,22 @@ public async Task V2Signup_DuplicateEmail_Returns409()
11883 await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Conflict ) ;
11984 }
12085
86+ [ Test , DependsOn ( nameof ( V2Signup_Success_CreatesUser ) ) ]
87+ public async Task V2Signup_DuplicateUsername_Returns409 ( )
88+ {
89+ using var client = WebApplicationFactory . CreateClient ( ) ;
90+
91+ var response = await client . PostAsync ( "/2/account/signup" , TestHelper . JsonContent ( new
92+ {
93+ username = "v2user" , // same username
94+ password = "SecurePassword123#" ,
95+ email = "v2different@test.org" ,
96+ turnstileResponse = "valid-token"
97+ } ) ) ;
98+
99+ await Assert . That ( response . StatusCode ) . IsEqualTo ( HttpStatusCode . Conflict ) ;
100+ }
101+
121102 // --- Validation ---
122103
123104 [ Test ]
0 commit comments