This commit is contained in:
2019-07-02 18:57:40 +00:00
parent d297e27496
commit 077f8bf9f0
4 changed files with 79 additions and 16 deletions

View File

@@ -147,6 +147,9 @@ namespace raven_integration
DUSER.roles = 0;//norole (any role can get a subset of locale keys) DUSER.roles = 0;//norole (any role can get a subset of locale keys)
DUSER.localeId = NewId;//random locale DUSER.localeId = NewId;//random locale
DUSER.userType = 3;//non scheduleable DUSER.userType = 3;//non scheduleable
//Required by form custom rules
DUSER.notes = "notes";
DUSER.customFields = Util.UserRequiredCustomFieldsJsonString();
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), DUSER.ToString()); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), DUSER.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
long DUSERID = a.ObjectResponse["data"]["id"].Value<long>(); long DUSERID = a.ObjectResponse["data"]["id"].Value<long>();

View File

@@ -19,7 +19,7 @@ namespace raven_integration
//CREATE //CREATE
dynamic D1 = new JObject(); dynamic D1 = new JObject();
D1.name = Util.Uniquify("First Test User"); D1.name = Util.Uniquify("First Test User");
D1.active = true; D1.active = true;
D1.login = Util.Uniquify("LOGIN"); D1.login = Util.Uniquify("LOGIN");
D1.password = Util.Uniquify("PASSWORD"); D1.password = Util.Uniquify("PASSWORD");
@@ -27,6 +27,10 @@ namespace raven_integration
D1.localeId = 1;//random locale D1.localeId = 1;//random locale
D1.userType = 3;//non scheduleable D1.userType = 3;//non scheduleable
//Required by form custom rules
D1.notes = "notes";
D1.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R1 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString()); ApiResponse R1 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
Util.ValidateDataReturnResponseOk(R1); Util.ValidateDataReturnResponseOk(R1);
long d1Id = R1.ObjectResponse["data"]["id"].Value<long>(); long d1Id = R1.ObjectResponse["data"]["id"].Value<long>();
@@ -34,7 +38,9 @@ namespace raven_integration
dynamic D2 = new JObject(); dynamic D2 = new JObject();
D2.name = Util.Uniquify("Second Test User"); D2.name = Util.Uniquify("Second Test User");
//Required by form custom rules
D2.notes = "notes";
D2.customFields = Util.UserRequiredCustomFieldsJsonString();
D2.active = true; D2.active = true;
D2.login = Util.Uniquify("LOGIN"); D2.login = Util.Uniquify("LOGIN");
D2.password = Util.Uniquify("PASSWORD"); D2.password = Util.Uniquify("PASSWORD");
@@ -60,7 +66,7 @@ namespace raven_integration
//PUT //PUT
//update w2id //update w2id
D2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST User"); D2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST User");
D2.concurrencyToken = R2.ObjectResponse["data"]["concurrencyToken"].Value<uint>(); D2.concurrencyToken = R2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
ApiResponse PUTTestResponse = await Util.PutAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString()); ApiResponse PUTTestResponse = await Util.PutAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
Util.ValidateHTTPStatusCode(PUTTestResponse, 200); Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
@@ -134,7 +140,8 @@ namespace raven_integration
//CREATE //CREATE
dynamic D = new JObject(); dynamic D = new JObject();
D.name = Util.Uniquify("PutConcurrencyViolationShouldFail"); D.name = Util.Uniquify("PutConcurrencyViolationShouldFail");
D.notes = "notes";
D.customFields = Util.UserRequiredCustomFieldsJsonString();
D.active = true; D.active = true;
D.login = Util.Uniquify("LOGIN"); D.login = Util.Uniquify("LOGIN");
D.password = Util.Uniquify("PASSWORD"); D.password = Util.Uniquify("PASSWORD");
@@ -167,13 +174,17 @@ namespace raven_integration
//CREATE //CREATE
dynamic D = new JObject(); dynamic D = new JObject();
D.name = Util.Uniquify("PatchConcurrencyViolationShouldFail"); D.name = Util.Uniquify("PatchConcurrencyViolationShouldFail");
D.active = true; D.active = true;
D.login = Util.Uniquify("LOGIN"); D.login = Util.Uniquify("LOGIN");
D.password = Util.Uniquify("PASSWORD"); D.password = Util.Uniquify("PASSWORD");
D.roles = 0;//norole D.roles = 0;//norole
D.localeId = 1;//random locale D.localeId = 1;//random locale
D.userType = 3;//non scheduleable D.userType = 3;//non scheduleable
//Required by form custom rules
D.notes = "notes";
D.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(R); Util.ValidateDataReturnResponseOk(R);
@@ -199,7 +210,7 @@ namespace raven_integration
//CREATE //CREATE
dynamic D = new JObject(); dynamic D = new JObject();
D.name = Util.Uniquify("DisallowedPatchAttemptsShouldFail"); D.name = Util.Uniquify("DisallowedPatchAttemptsShouldFail");
D.active = true; D.active = true;
D.login = Util.Uniquify("LOGIN"); D.login = Util.Uniquify("LOGIN");
D.password = Util.Uniquify("PASSWORD"); D.password = Util.Uniquify("PASSWORD");
@@ -207,6 +218,10 @@ namespace raven_integration
D.localeId = 1;//random locale D.localeId = 1;//random locale
D.userType = 3;//non scheduleable D.userType = 3;//non scheduleable
//Required by form custom rules
D.notes = "notes";
D.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(R); Util.ValidateDataReturnResponseOk(R);
long w2Id = R.ObjectResponse["data"]["id"].Value<long>(); long w2Id = R.ObjectResponse["data"]["id"].Value<long>();
@@ -218,7 +233,7 @@ namespace raven_integration
ApiResponse PATCHTestResponse = await Util.PatchAsync("User/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson); ApiResponse PATCHTestResponse = await Util.PatchAsync("User/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
Util.ValidateErrorCodeResponse(PATCHTestResponse, 2200, 400); Util.ValidateErrorCodeResponse(PATCHTestResponse, 2200, 400);
//PATCH attempt add field //PATCH attempt add field
patchJson = "[{\"value\": \"0\",\"path\": \"/bogus\",\"op\": \"add\"}]"; patchJson = "[{\"value\": \"0\",\"path\": \"/bogus\",\"op\": \"add\"}]";
PATCHTestResponse = await Util.PatchAsync("User/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson); PATCHTestResponse = await Util.PatchAsync("User/" + w2Id.ToString() + "/" + (OriginalConcurrencyToken - 1).ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
@@ -240,13 +255,16 @@ namespace raven_integration
//CREATE //CREATE
dynamic D = new JObject(); dynamic D = new JObject();
D.name = Util.Uniquify("PatchPasswordShouldWork"); D.name = Util.Uniquify("PatchPasswordShouldWork");
D.active = true; D.active = true;
D.login = Util.Uniquify("LOGIN"); D.login = Util.Uniquify("LOGIN");
D.password = Util.Uniquify("PASSWORD"); D.password = Util.Uniquify("PASSWORD");
D.roles = 0;//norole D.roles = 0;//norole
D.localeId = 1;//random locale D.localeId = 1;//random locale
D.userType = 3;//non scheduleable D.userType = 3;//non scheduleable
//Required by form custom rules
D.notes = "notes";
D.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(R); Util.ValidateDataReturnResponseOk(R);
@@ -285,13 +303,16 @@ namespace raven_integration
//CREATE //CREATE
dynamic D = new JObject(); dynamic D = new JObject();
D.name = Util.Uniquify("PutPasswordShouldWork"); D.name = Util.Uniquify("PutPasswordShouldWork");
D.active = true; D.active = true;
D.login = Util.Uniquify("LOGIN"); D.login = Util.Uniquify("LOGIN");
D.password = Util.Uniquify("PASSWORD"); D.password = Util.Uniquify("PASSWORD");
D.roles = 0;//norole D.roles = 0;//norole
D.localeId = 1;//random locale D.localeId = 1;//random locale
D.userType = 3;//non scheduleable D.userType = 3;//non scheduleable
//Required by form custom rules
D.notes = "notes";
D.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString()); ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
Util.ValidateDataReturnResponseOk(R); Util.ValidateDataReturnResponseOk(R);
@@ -344,6 +365,9 @@ namespace raven_integration
d.roles = 0;//norole d.roles = 0;//norole
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 3;//non scheduleable d.userType = 3;//non scheduleable
//Required by form custom rules
d.notes = "notes";
d.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString()); ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
@@ -357,6 +381,9 @@ namespace raven_integration
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 3;//non scheduleable d.userType = 3;//non scheduleable
d.active = true; 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()); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
@@ -370,6 +397,10 @@ namespace raven_integration
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 3;//non scheduleable d.userType = 3;//non scheduleable
d.active = false; d.active = false;
//Required by form custom rules
d.notes = "notes";
d.customFields = Util.UserRequiredCustomFieldsJsonString();
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString()); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>(); SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
@@ -492,6 +523,10 @@ namespace raven_integration
d.roles = 0;//norole d.roles = 0;//norole
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 3;//non scheduleable d.userType = 3;//non scheduleable
//Required by form custom rules
d.notes = "notes";
d.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString()); ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
@@ -505,6 +540,10 @@ namespace raven_integration
d.roles = 0;//norole d.roles = 0;//norole
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 2;//non scheduleable d.userType = 2;//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()); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>(); SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
@@ -517,6 +556,10 @@ namespace raven_integration
d.roles = 0;//norole d.roles = 0;//norole
d.localeId = 1;//random locale d.localeId = 1;//random locale
d.userType = 1;//non scheduleable d.userType = 1;//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()); a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
Util.ValidateDataReturnResponseOk(a); Util.ValidateDataReturnResponseOk(a);
FirstInOrderId = a.ObjectResponse["data"]["id"].Value<long>(); FirstInOrderId = a.ObjectResponse["data"]["id"].Value<long>();

View File

@@ -26,6 +26,9 @@ namespace raven_integration
D1.roles = 0;//norole D1.roles = 0;//norole
D1.localeId = 1;//random locale D1.localeId = 1;//random locale
D1.userType = 3;//non scheduleable D1.userType = 3;//non scheduleable
//Required by form custom rules
D1.notes = "notes";
D1.customFields = Util.UserRequiredCustomFieldsJsonString();
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString()); ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
Util.ValidateDataReturnResponseOk(R); Util.ValidateDataReturnResponseOk(R);

28
util.cs
View File

@@ -253,7 +253,7 @@ namespace raven_integration
var ERR = a.ObjectResponse["error"]; var ERR = a.ObjectResponse["error"];
if (ERR != null) if (ERR != null)
{ {
ErrorMessage=a.ObjectResponse.ToString(); ErrorMessage = a.ObjectResponse.ToString();
// var ecode = ERR["code"]; // var ecode = ERR["code"];
// if (ecode != null) // if (ecode != null)
// ErrorMessage += $"CODE: {ecode} "; // ErrorMessage += $"CODE: {ecode} ";
@@ -427,15 +427,15 @@ namespace raven_integration
dCustomField.c13 = c13; dCustomField.c13 = c13;
dCustomField.c14 = c14; dCustomField.c14 = c14;
dCustomField.c15 = c15; dCustomField.c15 = c15;
dCustomField.c16 = c16; dCustomField.c16 = c16;
return dCustomField.ToString(); return dCustomField.ToString();
} }
/// <summary> /// <summary>
/// Generate a custom fields string that satisfies the rules in the sample test data /// Generate a custom fields string that satisfies the rules in the sample test data
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static string WidgetRequiredCustomFieldsJsonString() public static string WidgetRequiredCustomFieldsJsonString()
{/*CURRENT TEMPLATE DEFINITION FOR WIDGET CUSTOM FIELDS, FROM SEEDER.CS SERVER PROJECT {/*CURRENT TEMPLATE DEFINITION FOR WIDGET CUSTOM FIELDS, FROM SEEDER.CS SERVER PROJECT
{ {
""template"": [ ""template"": [
@@ -489,5 +489,19 @@ namespace raven_integration
} }
/// <summary>
/// Generate a custom fields string that satisfies the rules in this project (formCustom)
/// </summary>
/// <returns></returns>
public static string UserRequiredCustomFieldsJsonString()
{
//Note c1 is only required custom, c2 is defined but is not required so skipping it here
dynamic dCustomField = new JObject();
dCustomField.c1 = "UnitTestUtilSampleText";
return dCustomField.ToString();
}
}//eoc }//eoc
}//eons }//eons