You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Service.Tests/CosmosTests/MutationTests.cs
+19-16Lines changed: 19 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,8 @@ public class MutationTests : TestBase
39
39
name
40
40
}
41
41
}";
42
+
privateconststringUSER_NOT_AUTHORIZED="The current user is not authorized to access this resource";
43
+
privateconststringNO_ERROR_MESSAGE=null;
42
44
43
45
/// <summary>
44
46
/// Executes once for the test.
@@ -257,12 +259,12 @@ public async Task MutationMissingRequiredPartitionKeyValueReturnError()
257
259
/// It throws permission denied error if role doesn't have permission to perform the operation
258
260
/// </summary>
259
261
[TestMethod]
260
-
[DataRow("field-mutation-with-read-permission",DataApiBuilderException.GRAPHQL_MUTATION_FIELD_AUTHZ_FAILURE,DisplayName=" exclude and include fields")]
[DataRow("field-mutation-with-read-permission",DataApiBuilderException.GRAPHQL_MUTATION_FIELD_AUTHZ_FAILURE,DisplayName="When there is limited permission at field level but have full read permission")]
263
+
[DataRow("authenticated",MutationTests.NO_ERROR_MESSAGE,DisplayName="When CRUD permission is there without any restriction")]
262
264
[DataRow("only-create-role","The mutation operation createEarth was successful "+
263
-
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="if only create permission is there")]
[DataRow("only-update-role","The current user is not authorized to access this resource",DisplayName="if create permission is not there")]
265
+
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="When ONLY create permission is there")]
266
+
[DataRow("wildcard-exclude-fields-role",DataApiBuilderException.GRAPHQL_MUTATION_FIELD_AUTHZ_FAILURE,DisplayName="When create permission is there at entity level but all the fields are excluded using wildcard")]
267
+
[DataRow("only-update-role",MutationTests.USER_NOT_AUTHORIZED,DisplayName="When create permission is NOT there")]
[DataRow("field-mutation-with-read-permission",DataApiBuilderException.GRAPHQL_MUTATION_FIELD_AUTHZ_FAILURE,DisplayName="When there is limited permission at field level but have full read permission")]
303
+
[DataRow("authenticated",NO_ERROR_MESSAGE,DisplayName="When CRUD permission is there without any restriction")]
302
304
[DataRow("only-update-role","The mutation operation updateEarth was successful "+
303
-
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="if only update permission is there")]
[DataRow("only-create-role","The current user is not authorized to access this resource",DisplayName="if update permission is not there")]
305
+
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="When ONLY update permission is there")]
306
+
[DataRow("wildcard-exclude-fields-role",DataApiBuilderException.GRAPHQL_MUTATION_FIELD_AUTHZ_FAILURE,DisplayName="When update permission is there at entity level but all the fields are excluded using wildcard")]
307
+
[DataRow("only-create-role",MutationTests.USER_NOT_AUTHORIZED,DisplayName="When update permission is NOT there")]
/// It throws permission denied error if role doesn't have permission to perform the operation
364
366
/// </summary>
365
367
[TestMethod]
366
-
[DataRow("field-mutation-with-read-permission",null,DisplayName=" exclude and include fields. Response is BLANK")]
367
-
[DataRow("authenticated",null,DisplayName="full permission. Response is BLANK")]
368
+
[DataRow("field-mutation-with-read-permission",MutationTests.NO_ERROR_MESSAGE,DisplayName="When there is limited permission at field level but have full read permission, Response is EMPTY string.")]
369
+
[DataRow("authenticated",MutationTests.NO_ERROR_MESSAGE,DisplayName="When CRUD permission is there without any restriction, Response is EMPTY string.")]
368
370
[DataRow("only-delete-role","The mutation operation deleteEarth was successful "+
369
-
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="if only update permission is there")]
370
-
[DataRow("wildcard-exclude-fields-role","The mutation operation deleteEarth was successful "+
371
-
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="exclude wildcard")]
372
-
[DataRow("only-create-role","The current user is not authorized to access this resource",DisplayName="if update permission is not there")]
371
+
"but the current user is unauthorized to view the response due to lack of read permissions",DisplayName="When ONLY delete permission is there")]
372
+
[DataRow("wildcard-exclude-fields-role",MutationTests.NO_ERROR_MESSAGE,DisplayName="When delete permission is there at entity level but all the fields are excluded using wildcard")]
373
+
[DataRow("only-create-role",MutationTests.USER_NOT_AUTHORIZED,DisplayName="When delete permission is NOT there")]
0 commit comments