This commit is contained in:
120
User/UserCrud.cs
120
User/UserCrud.cs
@@ -24,7 +24,7 @@ namespace raven_integration
|
|||||||
D1.login = Util.Uniquify("LOGIN");
|
D1.login = Util.Uniquify("LOGIN");
|
||||||
D1.password = Util.Uniquify("PASSWORD");
|
D1.password = Util.Uniquify("PASSWORD");
|
||||||
D1.roles = 0;//norole
|
D1.roles = 0;//norole
|
||||||
|
|
||||||
D1.userType = 3;//non scheduleable
|
D1.userType = 3;//non scheduleable
|
||||||
|
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
@@ -45,7 +45,7 @@ namespace raven_integration
|
|||||||
D2.login = Util.Uniquify("LOGIN");
|
D2.login = Util.Uniquify("LOGIN");
|
||||||
D2.password = Util.Uniquify("PASSWORD");
|
D2.password = Util.Uniquify("PASSWORD");
|
||||||
D2.roles = 0;//norole
|
D2.roles = 0;//norole
|
||||||
|
|
||||||
D2.userType = 3;//non scheduleable
|
D2.userType = 3;//non scheduleable
|
||||||
|
|
||||||
ApiResponse R2 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
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.login = Util.Uniquify("LOGIN");
|
||||||
D.password = Util.Uniquify("PASSWORD");
|
D.password = Util.Uniquify("PASSWORD");
|
||||||
D.roles = 0;//norole
|
D.roles = 0;//norole
|
||||||
|
|
||||||
D.userType = 3;//non scheduleable
|
D.userType = 3;//non scheduleable
|
||||||
|
|
||||||
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());
|
||||||
@@ -179,7 +179,7 @@ namespace raven_integration
|
|||||||
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.userType = 3;//non scheduleable
|
D.userType = 3;//non scheduleable
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
D.notes = "notes";
|
D.notes = "notes";
|
||||||
@@ -215,7 +215,7 @@ namespace raven_integration
|
|||||||
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.userType = 3;//non scheduleable
|
D.userType = 3;//non scheduleable
|
||||||
|
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
@@ -250,95 +250,55 @@ namespace raven_integration
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void PatchPasswordShouldWork()
|
public async void PutPasswordShouldWork()
|
||||||
{
|
{
|
||||||
//CREATE
|
//CREATE
|
||||||
dynamic D = new JObject();
|
dynamic d = new JObject();
|
||||||
D.name = Util.Uniquify("PatchPasswordShouldWork");
|
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.userType = 3;//non scheduleable
|
d.userType = 3;//non scheduleable
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
D.notes = "notes";
|
d.notes = "notes";
|
||||||
D.customFields = Util.UserRequiredCustomFieldsJsonString();
|
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||||
|
|
||||||
ApiResponse R = 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(R);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
long UserId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||||
|
|
||||||
//Test can login
|
//Test can login
|
||||||
dynamic DCreds = new JObject();
|
dynamic DCreds = new JObject();
|
||||||
DCreds.password = D.password;
|
DCreds.password = d.password;
|
||||||
DCreds.login = D.login;
|
DCreds.login = d.login;
|
||||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
a = await Util.PostAsync("Auth", null, DCreds.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
//GET user (login changed concurrency token above)
|
||||||
|
a = await Util.GetAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
d = a.ObjectResponse["data"];
|
||||||
|
|
||||||
|
|
||||||
//PUT
|
//PUT
|
||||||
var NewPassword = "NEW_PASSWORD";
|
var NewPassword = "NEW_PASSWORD";
|
||||||
D.password = NewPassword;
|
d.password = NewPassword;
|
||||||
D.concurrencyToken = OriginalConcurrencyToken;
|
a = await Util.PutAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||||
R = await Util.PutAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
|
||||||
|
|
||||||
//Test can login with new creds
|
//Test can login with new creds
|
||||||
//dynamic DCreds = new JObject();
|
//dynamic DCreds = new JObject();
|
||||||
DCreds.password = NewPassword;
|
DCreds.password = NewPassword;
|
||||||
DCreds.login = D.login;
|
DCreds.login = d.login;
|
||||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
a = await Util.PostAsync("Auth", null, DCreds.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
[Fact]
|
|
||||||
public async void PutPasswordShouldWork()
|
|
||||||
{
|
|
||||||
//CREATE
|
|
||||||
dynamic D = new JObject();
|
|
||||||
D.name = Util.Uniquify("PutPasswordShouldWork");
|
|
||||||
|
|
||||||
D.active = true;
|
|
||||||
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();
|
|
||||||
|
|
||||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
|
||||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
|
||||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
|
||||||
|
|
||||||
//Test can login
|
|
||||||
dynamic DCreds = new JObject();
|
|
||||||
DCreds.password = D.password;
|
|
||||||
DCreds.login = D.login;
|
|
||||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
|
||||||
|
|
||||||
//PATCH
|
|
||||||
var newPassword = "NEW_PASSWORD";
|
|
||||||
string patchJson = "[{\"value\": \"" + newPassword + "\",\"path\": \"/password\",\"op\": \"replace\"}]";
|
|
||||||
R = await Util.PatchAsync("User/" + UserId.ToString() + "/" + OriginalConcurrencyToken.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), patchJson);
|
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
|
||||||
|
|
||||||
//Test can login with new creds
|
|
||||||
//dynamic DCreds = new JObject();
|
|
||||||
DCreds.password = newPassword;
|
|
||||||
DCreds.login = D.login;
|
|
||||||
R = await Util.PostAsync("Auth", null, DCreds.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(R);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -363,7 +323,7 @@ namespace raven_integration
|
|||||||
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.userType = 3;//non scheduleable
|
d.userType = 3;//non scheduleable
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
d.notes = "notes";
|
d.notes = "notes";
|
||||||
@@ -378,7 +338,7 @@ namespace raven_integration
|
|||||||
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.userType = 3;//non scheduleable
|
d.userType = 3;//non scheduleable
|
||||||
d.active = true;
|
d.active = true;
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
@@ -394,7 +354,7 @@ namespace raven_integration
|
|||||||
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.userType = 3;//non scheduleable
|
d.userType = 3;//non scheduleable
|
||||||
d.active = false;
|
d.active = false;
|
||||||
//Required by form custom rules
|
//Required by form custom rules
|
||||||
@@ -436,7 +396,7 @@ namespace raven_integration
|
|||||||
//name starts with filter to constrict to widgets that this test block created only
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("username", Util.OpStartsWith, ObjectNameStart));
|
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("username", Util.OpStartsWith, ObjectNameStart));
|
||||||
dListView.Add(Util.BuildSimpleSortDataListViewColumn("useractive", "+"));
|
dListView.Add(Util.BuildSimpleSortDataListViewColumn("useractive", "+"));
|
||||||
//DEPRECATED NO DF ANYMORE dListView.Add(Util.BuildSimpleSortDataListViewColumn("df", "+"));
|
//DEPRECATED NO DF ANYMORE dListView.Add(Util.BuildSimpleSortDataListViewColumn("df", "+"));
|
||||||
|
|
||||||
//NOW FETCH WIDGET LIST WITH FILTER UserDataList
|
//NOW FETCH WIDGET LIST WITH FILTER UserDataList
|
||||||
// a = await Util.GetAsync($"DataList/list?DataListKey=UserDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
// a = await Util.GetAsync($"DataList/list?DataListKey=UserDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
|||||||
Reference in New Issue
Block a user