This commit is contained in:
154
User/UserCrud.cs
154
User/UserCrud.cs
@@ -299,130 +299,50 @@ namespace raven_integration
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void NonUniqueLoginShouldFail()
|
||||
{
|
||||
var UniqueLogin = Util.Uniquify("NonUniqueLoginShouldFail");
|
||||
//CREATE FIRST USER
|
||||
dynamic d = new JObject();
|
||||
d.name = Util.Uniquify("NonUniqueLoginShouldFail");
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
d.active = false;
|
||||
d.login = UniqueLogin;
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
d.userType = 3;//non scheduleable
|
||||
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
|
||||
//This is testing datalist, not user crud, removing
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async void UserListFilterAndSortWorks()
|
||||
// {
|
||||
//Attempt create second with same login
|
||||
d = new JObject();
|
||||
d.name = Util.Uniquify("2NonUniqueLoginShouldFail");
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
d.active = false;
|
||||
d.login = UniqueLogin;
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
d.userType = 3;//non scheduleable
|
||||
|
||||
// var ObjectNameStart = Util.Uniquify("UserListFilterAndSortWorks");
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
|
||||
// //CREATE 3 TEST OBJECTS TO TEST ORDER
|
||||
// long FirstInOrdertId = 0;
|
||||
// long SecondInOrderId = 0;
|
||||
// long ThirdInOrderId = 0;
|
||||
Util.ValidateErrorCodeResponse(a, 2200, 400);
|
||||
Util.ShouldContainValidationError(a, "Login", "2206");
|
||||
/*
|
||||
"{\"error\":{\"code\":\"2200\",\"details\":[{\"target\":\"Login\",\"error\":\"2206\"}],\"message\":\"Object did not pass validation\"}}"
|
||||
*/
|
||||
|
||||
// dynamic d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// 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();
|
||||
|
||||
// ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// FirstInOrdertId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
// d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// 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);
|
||||
// ThirdInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
// d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// d.login = Util.Uniquify("LOGIN");
|
||||
// d.password = Util.Uniquify("PASSWORD");
|
||||
// d.roles = 0;//norole
|
||||
|
||||
// d.userType = 3;//non scheduleable
|
||||
// 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());
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
// //CREATE FILTER
|
||||
|
||||
// //FILTER IN BY NAME FOR TESTING THIS RUN ONLY
|
||||
// // dynamic dfilter = new JArray();
|
||||
// // //name starts with filter to constrict to widgets that this test block created only
|
||||
// // dynamic DataFilterNameStart = new JObject();
|
||||
// // DataFilterNameStart.fld = "username";
|
||||
// // DataFilterNameStart.op = Util.OpStartsWith;
|
||||
// // DataFilterNameStart.value = ObjectNameStart;
|
||||
// // dfilter.Add(DataFilterNameStart);
|
||||
|
||||
// // dynamic dsortarray = new JArray();
|
||||
|
||||
// //SORT ORDER ###################
|
||||
// //sort by active then by ID
|
||||
|
||||
// // dynamic dsort = new JObject();
|
||||
// // dsort.fld = "useractive";
|
||||
// // dsort.dir = "+";
|
||||
// // dsortarray.Add(dsort);
|
||||
|
||||
// // dsort = new JObject();
|
||||
// // dsort.fld = "df";
|
||||
// // dsort.dir = "+";
|
||||
// // dsortarray.Add(dsort);
|
||||
|
||||
// dynamic dListView = new JArray();
|
||||
// //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.BuildSimpleSortDataListViewColumn("useractive", "+"));
|
||||
// //DEPRECATED NO DF ANYMORE dListView.Add(Util.BuildSimpleSortDataListViewColumn("df", "+"));
|
||||
|
||||
// //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.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequestEx(dListView, 999, 0, "TestUserDataList"));
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
// //assert contains exactly 3 records
|
||||
// ((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||
|
||||
// //assert the order returned
|
||||
// a.ObjectResponse["data"][0][0]["i"].Value<long>().Should().Be(FirstInOrdertId);
|
||||
// a.ObjectResponse["data"][1][0]["i"].Value<long>().Should().Be(SecondInOrderId);
|
||||
// a.ObjectResponse["data"][2][0]["i"].Value<long>().Should().Be(ThirdInOrderId);
|
||||
|
||||
|
||||
// a = await Util.DeleteAsync("User/" + FirstInOrdertId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
// a = await Util.DeleteAsync("User/" + SecondInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
// a = await Util.DeleteAsync("User/" + ThirdInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
Reference in New Issue
Block a user