This commit is contained in:
2020-03-18 00:01:03 +00:00
parent 97af1a573c
commit 28b691ad58

View File

@@ -164,6 +164,78 @@ namespace raven_integration
}
/// <summary>
/// test get picklist for widget without query
/// </summary>
[Fact]
public async void FetchWidgetPickListNoQuery()
{
//RETRIEVE WIDGET PICKLIST no filter
ApiResponse a = await Util.GetAsync("PickList/List?ayaType=2", 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(100);
}
/// <summary>
/// test get picklist for widget with basic autocomplete query only
/// </summary>
[Fact]
public async void FetchWidgetPickListAutoComplete()
{
//make key widget
var WidgetNameStart = "FetchWidgetPickListAutoComplete_UnIqUe";
long IncludedWidgetId = 0;
//CREATE TEST WIDGETS
//included widget
dynamic w = new JObject();
w.name = Util.Uniquify(WidgetNameStart);
w.customFields = Util.WidgetRequiredCustomFieldsJsonString();
w.notes = "blah";
w.active = true;
w.usertype = 1;
w.dollarAmount = 555.55;
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
Util.ValidateDataReturnResponseOk(a);
IncludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//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);
//DELETE WIDGETS
a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
Util.ValidateHTTPStatusCode(a, 204);
}
//autocomplete filter test returns record in results
//tag filter test returns correct record
//inactive test (make two keyed and search for )
//error condition tests
//User picklist custom template works with picklist fetch
//not sure where to do that, I guess 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?)
//==================================================
}//eoc