This commit is contained in:
2020-03-18 15:45:40 +00:00
parent bc5e21ac6b
commit e450e7bc34
7 changed files with 103 additions and 49 deletions

View File

@@ -46,20 +46,12 @@ namespace raven_integration
[Fact]
public async void GetSubsetWorks()
{
/*
{
"localeId": 0,
"keys": [
"string"
]
}
*/
List<string> keys = new List<string>();
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());
@@ -145,7 +137,7 @@ namespace raven_integration
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
DUSER.notes = "notes";
@@ -159,7 +151,7 @@ namespace raven_integration
List<string> keys = new List<string>();
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());

View File

@@ -30,7 +30,7 @@ namespace raven_integration
List<string> keys = new List<string>();
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

View File

@@ -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?)
//==================================================

View File

@@ -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();

View File

@@ -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";

View File

@@ -1,7 +1,5 @@
using System;
using Xunit;
using Newtonsoft.Json.Linq;
using FluentAssertions;
namespace raven_integration
{

View File

@@ -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";