diff --git a/PickList/PickListAllTests.cs b/PickList/PickListAllTests.cs index 75aef5a..a1e871e 100644 --- a/PickList/PickListAllTests.cs +++ b/PickList/PickListAllTests.cs @@ -164,6 +164,78 @@ namespace raven_integration } + /// + /// test get picklist for widget without query + /// + [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); + } + + + /// + /// test get picklist for widget with basic autocomplete query only + /// + [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(); + + + //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().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