diff --git a/Locale/Locale.cs b/Locale/Locale.cs index 6827564..9c1e581 100644 --- a/Locale/Locale.cs +++ b/Locale/Locale.cs @@ -46,20 +46,12 @@ namespace raven_integration [Fact] public async void GetSubsetWorks() { - /* - { - "localeId": 0, - "keys": [ - "string" - ] - } - */ + List keys = new List(); keys.AddRange(new string[] { "AddressType", "ClientName", "RateName", "WorkorderService" }); dynamic d = new JObject(); - //d.localeId = 1; - //d.keys = JToken.FromObject(keys); + d = JToken.FromObject(keys); ApiResponse a = await Util.PostAsync("Locale/subset", await Util.GetTokenAsync("CustomerLimited"), d.ToString()); @@ -140,14 +132,14 @@ namespace raven_integration var Password = Util.Uniquify("PASSWORD"); dynamic DUSER = new JObject(); DUSER.name = Util.Uniquify("LocaleUpdateSubsetTestUser"); - + DUSER.active = true; DUSER.login = Login; DUSER.password = Password; DUSER.roles = 0;//norole (any role can get a subset of locale keys) - DUSER.localeId = NewId;//random locale + DUSER.translationId = NewId; DUSER.userType = 3;//non scheduleable - //Required by form custom rules + //Required by form custom rules DUSER.notes = "notes"; DUSER.customFields = Util.UserRequiredCustomFieldsJsonString(); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), DUSER.ToString()); @@ -159,7 +151,7 @@ namespace raven_integration List keys = new List(); keys.AddRange(new string[] { UpdatedLocaleKey }); dynamic d3 = new JObject(); - //d3.localeId = NewId; + d3 = JToken.FromObject(keys); checkPUTWorked = await Util.PostAsync("Locale/subset", await Util.GetTokenAsync(Login, Password), d3.ToString()); diff --git a/Locale/RequestedLocaleKeys.cs b/Locale/RequestedLocaleKeys.cs index d758fb5..f716592 100644 --- a/Locale/RequestedLocaleKeys.cs +++ b/Locale/RequestedLocaleKeys.cs @@ -30,7 +30,7 @@ namespace raven_integration List keys = new List(); keys.AddRange(new string[] { "HelpLicense", "ClientName" }); dynamic d = new JObject(); - //d.localeId = 1; + d = JToken.FromObject(keys); //Fetch the values to force RAVEN to track at least these two diff --git a/PickList/PickListAllTests.cs b/PickList/PickListAllTests.cs index 6423685..3d58ef8 100644 --- a/PickList/PickListAllTests.cs +++ b/PickList/PickListAllTests.cs @@ -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()); templateArray.Count.Should().Be(1); - templateArray[0]["fld"].Value().Should().Be("useremployeenumber"); ; + templateArray[0]["fld"].Value().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(); + + 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(); + + + //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().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().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()); templateArray.Count.Should().Be(3); - templateArray[0]["fld"].Value().Should().Be("username"); ; + templateArray[0]["fld"].Value().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?) - //================================================== diff --git a/Search/SearchOps.cs b/Search/SearchOps.cs index 5ea81bd..06bdd7f 100644 --- a/Search/SearchOps.cs +++ b/Search/SearchOps.cs @@ -40,7 +40,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); @@ -57,7 +57,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); @@ -194,7 +194,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable D.customFields = Util.UserRequiredCustomFieldsJsonString(); @@ -258,7 +258,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable D.customFields = Util.UserRequiredCustomFieldsJsonString(); @@ -324,7 +324,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable D.customFields = Util.UserRequiredCustomFieldsJsonString(); @@ -423,7 +423,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.usertype = 1; - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable D.customFields = Util.UserRequiredCustomFieldsJsonString(); diff --git a/User/UserCrud.cs b/User/UserCrud.cs index 1746183..f724cbe 100644 --- a/User/UserCrud.cs +++ b/User/UserCrud.cs @@ -24,7 +24,7 @@ namespace raven_integration D1.login = Util.Uniquify("LOGIN"); D1.password = Util.Uniquify("PASSWORD"); D1.roles = 0;//norole - D1.localeId = 1;//random locale + D1.userType = 3;//non scheduleable //Required by form custom rules @@ -45,7 +45,7 @@ namespace raven_integration D2.login = Util.Uniquify("LOGIN"); D2.password = Util.Uniquify("PASSWORD"); D2.roles = 0;//norole - D2.localeId = 1;//random locale + D2.userType = 3;//non scheduleable ApiResponse R2 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString()); @@ -146,7 +146,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.roles = 0;//norole - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); @@ -179,7 +179,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.roles = 0;//norole - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable //Required by form custom rules D.notes = "notes"; @@ -215,7 +215,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.roles = 0;//norole - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable //Required by form custom rules @@ -260,7 +260,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.roles = 0;//norole - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable //Required by form custom rules D.notes = "notes"; @@ -308,7 +308,7 @@ namespace raven_integration D.login = Util.Uniquify("LOGIN"); D.password = Util.Uniquify("PASSWORD"); D.roles = 0;//norole - D.localeId = 1;//random locale + D.userType = 3;//non scheduleable //Required by form custom rules D.notes = "notes"; @@ -363,7 +363,7 @@ namespace raven_integration d.login = Util.Uniquify("LOGIN"); d.password = Util.Uniquify("PASSWORD"); d.roles = 0;//norole - d.localeId = 1;//random locale + d.userType = 3;//non scheduleable //Required by form custom rules d.notes = "notes"; @@ -378,7 +378,7 @@ namespace raven_integration d.login = Util.Uniquify("LOGIN"); d.password = Util.Uniquify("PASSWORD"); d.roles = 0;//norole - d.localeId = 1;//random locale + d.userType = 3;//non scheduleable d.active = true; //Required by form custom rules @@ -394,7 +394,7 @@ namespace raven_integration d.login = Util.Uniquify("LOGIN"); d.password = Util.Uniquify("PASSWORD"); d.roles = 0;//norole - d.localeId = 1;//random locale + d.userType = 3;//non scheduleable d.active = false; //Required by form custom rules @@ -513,7 +513,7 @@ namespace raven_integration // d.login = Util.Uniquify("LOGIN"); // d.password = Util.Uniquify("PASSWORD"); // d.roles = 0;//norole - // d.localeId = 1;//random locale + // // d.userType = 3;//non scheduleable // //Required by form custom rules // d.notes = "notes"; @@ -530,7 +530,7 @@ namespace raven_integration // d.login = Util.Uniquify("LOGIN"); // d.password = Util.Uniquify("PASSWORD"); // d.roles = 0;//norole - // d.localeId = 1;//random locale + // // d.userType = 2;//non scheduleable // //Required by form custom rules // d.notes = "notes"; @@ -546,7 +546,7 @@ namespace raven_integration // d.login = Util.Uniquify("LOGIN"); // d.password = Util.Uniquify("PASSWORD"); // d.roles = 0;//norole - // d.localeId = 1;//random locale + // // d.userType = 1;//non scheduleable // //Required by form custom rules // d.notes = "notes"; diff --git a/User/UserInactive.cs b/User/UserInactive.cs index 9e7a06b..94e5db1 100644 --- a/User/UserInactive.cs +++ b/User/UserInactive.cs @@ -1,7 +1,5 @@ -using System; using Xunit; using Newtonsoft.Json.Linq; -using FluentAssertions; namespace raven_integration { diff --git a/User/UserOptions.cs b/User/UserOptions.cs index 71b20f4..798d047 100644 --- a/User/UserOptions.cs +++ b/User/UserOptions.cs @@ -24,7 +24,7 @@ namespace raven_integration D1.login = Util.Uniquify("LOGIN"); D1.password = Util.Uniquify("PASSWORD"); D1.roles = 0;//norole - D1.localeId = 1;//random locale + D1.translationId=1; D1.userType = 3;//non scheduleable //Required by form custom rules D1.notes = "notes";