This commit is contained in:
@@ -7,7 +7,6 @@ using System.Collections.Concurrent;
|
||||
|
||||
namespace raven_integration
|
||||
{
|
||||
|
||||
public class PickListAllTests
|
||||
{
|
||||
//NOTE: in order not to interfere in each other will use Widget picklist to test with standard unmodified picklist template
|
||||
@@ -26,7 +25,7 @@ namespace raven_integration
|
||||
dynamic d = new JObject();
|
||||
d.Id = 3;//User type
|
||||
|
||||
//template, simple test, nothing fancy
|
||||
//custom template, only one field employee number
|
||||
dynamic dTemplateArray = new JArray();
|
||||
dynamic df = new JObject();
|
||||
df.fld = "useremployeenumber";
|
||||
@@ -45,10 +44,82 @@ namespace raven_integration
|
||||
//assert contains ONE record ONLY and it's the one we set
|
||||
var templateArray = JArray.Parse(a.ObjectResponse["data"]["template"].Value<string>());
|
||||
templateArray.Count.Should().Be(1);
|
||||
templateArray[0]["fld"].Value<string>().Should().Be("useremployeenumber"); ;
|
||||
templateArray[0]["fld"].Value<string>().Should().Be("useremployeenumber");
|
||||
|
||||
|
||||
// RESET TO DEFAULT
|
||||
//CONFIRM THE CUSTOM PICKLIST TEMPLATE WORKS PROPERLY
|
||||
//MAKE THE TEST USERS
|
||||
//First make a unique string for this iteration of this test only
|
||||
var UniquePhrase = Util.Uniquify("pick").Replace(" ", "");
|
||||
d = new JObject();
|
||||
d.name = Util.Uniquify("UserPickListTemplatesOps") + UniquePhrase;
|
||||
d.active = false;
|
||||
d.login = Util.Uniquify("LOGIN");
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
|
||||
d.userType = 3;//non scheduleable
|
||||
//Required by form custom rules
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long InNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
d = new JObject();
|
||||
d.name = Util.Uniquify("UserPickListTemplatesOps");
|
||||
d.employeeNumber = UniquePhrase;
|
||||
d.login = Util.Uniquify("LOGIN");
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
d.userType = 3;//non scheduleable
|
||||
d.active = true;
|
||||
//Required by form custom rules
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long InEmployeeNumberId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//GET PICKLIST FOR unique phrase query sb only employee number due to custom template
|
||||
a = await Util.GetAsync("PickList/List?ayaType=3&query=" + UniquePhrase, await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
pickList.Count.Should().Be(1);
|
||||
pickList[0]["id"].Value<long>().Should().Be(InEmployeeNumberId);
|
||||
|
||||
//custom template, only one field user name
|
||||
d = new JObject();
|
||||
d.Id = 3;//User type
|
||||
dTemplateArray = new JArray();
|
||||
df = new JObject();
|
||||
df.fld = "username";
|
||||
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));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
//GET PICKLIST FOR unique phrase query sb only user name field due to custom template
|
||||
a = await Util.GetAsync("PickList/List?ayaType=3&query=" + UniquePhrase, await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
pickList.Count.Should().Be(1);
|
||||
pickList[0]["id"].Value<long>().Should().Be(InNameId);
|
||||
|
||||
//DELETE TEST USERS NO LONGER NEEDED
|
||||
a = await Util.DeleteAsync("User/" + InNameId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
a = await Util.DeleteAsync("User/" + InEmployeeNumberId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
|
||||
// RESET TEMPLATE TO DEFAULT
|
||||
a = await Util.DeleteAsync("PickList/Template/3/", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
@@ -59,7 +130,7 @@ namespace raven_integration
|
||||
//assert contains default template record ONLY and it's the one we set
|
||||
templateArray = JArray.Parse(a.ObjectResponse["data"]["template"].Value<string>());
|
||||
templateArray.Count.Should().Be(3);
|
||||
templateArray[0]["fld"].Value<string>().Should().Be("username"); ;
|
||||
templateArray[0]["fld"].Value<string>().Should().Be("username");
|
||||
|
||||
|
||||
//Now test error conditions....
|
||||
@@ -369,13 +440,6 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
//error condition tests
|
||||
|
||||
//Customized template works
|
||||
//User picklist custom template works with picklist fetch
|
||||
//do that up top in the consolidated User picklist type because I can't change the widget template without breaking shit
|
||||
//or maybe they all need to use a default custom template that is the same for all (and includes tags?)
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
Reference in New Issue
Block a user