This commit is contained in:
@@ -2795,7 +2795,7 @@ same as the server does but in a central location here for all tests to use.
|
||||
//assert contains at least two records
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(1);
|
||||
var v = ((JArray)a.ObjectResponse["data"]);
|
||||
List<long> IDInResultList = new List<long>();
|
||||
// List<long> IDInResultList = new List<long>();
|
||||
int nActiveMatches = 0;
|
||||
int nInactiveMatches = 0;
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace raven_integration
|
||||
//RETRIEVE WIDGET PICKLIST with name filter
|
||||
a = await Util.GetAsync("PickList/List?ayaType=2&query=IqU", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
//assert contains 100 records (current picklist maximum count)
|
||||
|
||||
var pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
pickList.Count.Should().Be(1);
|
||||
pickList[0]["id"].Value<long>().Should().Be(IncludedWidgetId);
|
||||
@@ -252,7 +252,7 @@ namespace raven_integration
|
||||
//RETRIEVE WIDGET PICKLIST with name filter
|
||||
a = await Util.GetAsync("PickList/List?ayaType=2&query=..lblu", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
//assert contains 100 records (current picklist maximum count)
|
||||
|
||||
var pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
pickList.Count.Should().Be(1);
|
||||
pickList[0]["id"].Value<long>().Should().Be(IncludedWidgetId);
|
||||
@@ -263,9 +263,113 @@ namespace raven_integration
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// test get picklist for widget with basic autocomplete query only
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void FetchWidgetPickListInactiveActive()
|
||||
{
|
||||
|
||||
//make key widget
|
||||
|
||||
var WidgetNameStart = "FetchWidgetPickListInactiveActive";
|
||||
List<long> ActiveWidgetIdList = new List<long>();
|
||||
List<long> NotActiveWidgetIdList = new List<long>();
|
||||
|
||||
//CREATE 4 TEST WIDGETS
|
||||
//two active and two non active
|
||||
|
||||
//first active widget
|
||||
dynamic w = new JObject();
|
||||
w.name = Util.Uniquify(WidgetNameStart);
|
||||
w.customFields = Util.WidgetRequiredCustomFieldsJsonString();
|
||||
w.notes = "blah";
|
||||
w.active = true;
|
||||
w.usertype = 1;
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
ActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
//second active widget
|
||||
w.name = Util.Uniquify(WidgetNameStart);
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
ActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
|
||||
//first NON active widget
|
||||
w.name = Util.Uniquify(WidgetNameStart);
|
||||
w.active = false;
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
NotActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
//second NON active widget
|
||||
w.name = Util.Uniquify(WidgetNameStart);
|
||||
w.active = false;
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
NotActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
|
||||
//CONFIRM BOTH INACTIVE AND ACTIVE
|
||||
a = await Util.GetAsync("PickList/List?ayaType=2&query=ickListInactiveAct&inactive=true", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
//assert contains at least two records
|
||||
pickList.Count.Should().BeGreaterThan(1);
|
||||
int nActiveMatches = 0;
|
||||
int nInactiveMatches = 0;
|
||||
foreach (JObject o in pickList)
|
||||
{
|
||||
if (ActiveWidgetIdList.Contains(o["id"].Value<long>()))
|
||||
nActiveMatches++;
|
||||
if (NotActiveWidgetIdList.Contains(o["id"].Value<long>()))
|
||||
nInactiveMatches++;
|
||||
}
|
||||
nActiveMatches.Should().Be(ActiveWidgetIdList.Count);
|
||||
nInactiveMatches.Should().Be(NotActiveWidgetIdList.Count);
|
||||
|
||||
|
||||
//CONFIRM ACTIVE ONLY
|
||||
a = await Util.GetAsync("PickList/List?ayaType=2&query=ickListInactiveAct", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
pickList = ((JArray)a.ObjectResponse["data"]);
|
||||
//assert contains at least two records
|
||||
pickList.Count.Should().BeGreaterThan(1);
|
||||
nActiveMatches = 0;
|
||||
nInactiveMatches = 0;
|
||||
foreach (JObject o in pickList)
|
||||
{
|
||||
if (ActiveWidgetIdList.Contains(o["id"].Value<long>()))
|
||||
nActiveMatches++;
|
||||
if (NotActiveWidgetIdList.Contains(o["id"].Value<long>()))
|
||||
nInactiveMatches++;
|
||||
}
|
||||
nActiveMatches.Should().Be(ActiveWidgetIdList.Count);
|
||||
nInactiveMatches.Should().Be(0);
|
||||
|
||||
|
||||
|
||||
//DELETE WIDGETS
|
||||
foreach (long l in ActiveWidgetIdList)
|
||||
{
|
||||
a = await Util.DeleteAsync("Widget/" + l.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
}
|
||||
|
||||
foreach (long l in NotActiveWidgetIdList)
|
||||
{
|
||||
a = await Util.DeleteAsync("Widget/" + l.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//same as above but tag filter version test returns correct record
|
||||
//inactive test (make two keyed and search for )
|
||||
//error condition tests
|
||||
|
||||
|
||||
Reference in New Issue
Block a user