From 3bf84b0a7b4c6b4f8584902682495f203495cc4e Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 17 Mar 2020 23:16:02 +0000 Subject: [PATCH] --- PickList/PickListAllTests.cs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/PickList/PickListAllTests.cs b/PickList/PickListAllTests.cs index 72f62db..cb81471 100644 --- a/PickList/PickListAllTests.cs +++ b/PickList/PickListAllTests.cs @@ -79,7 +79,7 @@ namespace raven_integration Util.ValidateErrorCodeResponse(a, 2200, 400); Util.ShouldContainValidationError(a, "Template", "2203"); - //BAD AYATYPE ERROR + //BAD AYATYPE ERROR d = new JObject(); d.Id = 0;//<==ERROR NO_TYPE, INVALID //template, simple test, nothing fancy @@ -94,10 +94,31 @@ namespace raven_integration Util.ValidateErrorCodeResponse(a, 2200, 400); Util.ShouldContainValidationError(a, "ayaType", "2203"); + //RIGHTS ISSUE, + //currently only bizadminfull can change a picklist template + d = new JObject(); + d.Id = 3;//User + //template, simple test, nothing fancy + dTemplateArray = new JArray(); + df = new JObject(); + df.fld = "useremployeenumber"; + dTemplateArray.Add(df); + d.Template = dTemplateArray.ToString(Newtonsoft.Json.Formatting.None); + //replace the User template at the server + //ERROR NO RIGHTS USER + a = await Util.PostAsync("PickList/Template", await Util.GetTokenAsync("CustomerLimited"), d.ToString(Newtonsoft.Json.Formatting.None)); + //"{\"error\":{\"code\":\"2004\",\"message\":\"User not authorized for this resource operation (insufficient rights)\"}}" + Util.ValidateErrorCodeResponse(a, 2004, 403); + + //EMPTY TEMPLATE VALIDATION ERROR + d = new JObject(); + d.Id = 3;//User + d.Template = "";//<-- ERROR no template + a = await Util.PostAsync("PickList/Template", await Util.GetTokenAsync("BizAdminFull"), d.ToString(Newtonsoft.Json.Formatting.None)); + Util.ValidateErrorCodeResponse(a, 2200, 400); + Util.ShouldContainValidationError(a, "Template", "2201"); + - //bad field name - //no such list - //no rights? (might need to make some changes at server, right now maybe anyone can modify template (bad)) //empty template //malformed template bad json?