This commit is contained in:
2020-03-17 23:05:46 +00:00
parent 5e3164a876
commit 63b55ca33a

View File

@@ -64,23 +64,37 @@ namespace raven_integration
//Now test error conditions....
//BAD FIELD NAME VALIDATION ERROR
d = new JObject();
d.Id = 3;//User type
d.Id = 3;//User type
//template, simple test, nothing fancy
dTemplateArray = new JArray();
df = new JObject();
df.fld = "DOES_NOT_EXIST";
df.fld = "DOES_NOT_EXIST";//<-- ERROR BAD FIELD NAME
dTemplateArray.Add(df);
d.Template = dTemplateArray.ToString(Newtonsoft.Json.Formatting.None);
//replace the User template at the server
a = await Util.PostAsync("PickList/Template", await Util.GetTokenAsync("BizAdminFull"), d.ToString(Newtonsoft.Json.Formatting.None));
//"{\"error\":{\"code\":\"2200\",\"details\":[{\"message\":\"Template array item 0, fld property value \\\"DOES_NOT_EXIST\\\" is not a valid value for AyaType specified\",\"target\":\"Template\",\"error\":\"2203\"}],\"message\":\"Object did not pass validation\"}}"
Util.ValidateErrorCodeResponse(a, 2200, 400);
Util.ShouldContainValidationError(a, "Template", "2203");
//BAD AYATYPE ERROR
d = new JObject();
d.Id = 0;//<==ERROR NO_TYPE, INVALID
//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
a = await Util.PostAsync("PickList/Template", await Util.GetTokenAsync("BizAdminFull"), d.ToString(Newtonsoft.Json.Formatting.None));
//"{\"error\":{\"code\":\"2200\",\"details\":[{\"message\":\"Template array item 0, fld property value \\\"DOES_NOT_EXIST\\\" is not a valid value for AyaType specified\",\"target\":\"Template\",\"error\":\"2203\"}],\"message\":\"Object did not pass validation\"}}"
Util.ValidateErrorCodeResponse(a, 2200, 400);
Util.ShouldContainValidationError(a, "ayaType", "2203");
//bad field name
//no such list
//no rights? (might need to make some changes at server, right now maybe anyone can modify template (bad))