Skip to content

Commit cd5b9d7

Browse files
Fix test
1 parent c233df2 commit cd5b9d7

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/Service.Tests/Authentication/EasyAuthAuthenticationUnitTests.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ public async Task TestValidStaticWebAppsEasyAuthTokenWithAnonymousRoleOnly()
327327
DisplayName = "Anonymous role - X-MS-API-ROLE is not honored")]
328328
[DataRow(true, "author",
329329
DisplayName = "Authenticated role - existing X-MS-API-ROLE is honored")]
330-
[TestMethod]
331330
public async Task TestClientRoleHeaderPresence(bool addAuthenticated, string clientRoleHeader)
332331
{
333332
string generatedToken = AuthTestHelper.CreateStaticWebAppsEasyAuthToken(addAuthenticated);
@@ -357,23 +356,19 @@ public async Task TestInvalidQueryInHeader()
357356
""auth_typ"":""aad"",
358357
""claims"":[
359358
{
360-
""typ"":""x', N'v';
361-
SET IDENTITY_INSERT authors ON;
362-
INSERT INTO authors (id, name, birthdate) VALUES (10001, 'Hidden Author', '2001-01-01');
363-
SET IDENTITY_INSERT authors OFF;
364-
SELECT 1 AS inserted FOR JSON PATH, WITHOUT_ARRAY_WRAPPER;
365-
--"",
359+
""typ"":""x', N'v';SET IDENTITY_INSERT authors ON;INSERT INTO authors (id, name, birthdate) VALUES (10001, 'Hidden Author', '2001-01-01');SET IDENTITY_INSERT authors OFF;SELECT 1 AS inserted FOR JSON PATH, WITHOUT_ARRAY_WRAPPER;--"",
366360
""val"":""x""
367361
}
368-
]
362+
],
363+
""UserRoles"":[""anonymous""]
369364
}";
370365

371366
string generatedToken = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(header));
372367
HttpContext postMiddlewareContext =
373368
await SendRequestAndGetHttpContextState(
374369
generatedToken,
375370
EasyAuthType.StaticWebApps,
376-
clientRoleHeader: "authenticated");
371+
clientRoleHeader: "anonymous");
377372
Assert.AreEqual(expected: (int)HttpStatusCode.OK, actual: postMiddlewareContext.Response.StatusCode);
378373

379374
using IHost host = await WebHostBuilderHelper.CreateWebHost(EasyAuthType.StaticWebApps.ToString(), false);

0 commit comments

Comments
 (0)