This commit is contained in:
@@ -21,14 +21,13 @@ namespace raven_integration
|
|||||||
//This is a special case, you can create or PUT a formcustom, but you can't delete one and you can't create one if one already exists
|
//This is a special case, you can create or PUT a formcustom, but you can't delete one and you can't create one if one already exists
|
||||||
//so this test will either create or update depending upon if it's already created one or not
|
//so this test will either create or update depending upon if it's already created one or not
|
||||||
|
|
||||||
|
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.formkey = "widget";
|
d.formkey = "widget";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Example:
|
Example:
|
||||||
{template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
|
{template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dynamic dtemplate = new JArray();
|
dynamic dtemplate = new JArray();
|
||||||
|
|
||||||
@@ -53,113 +52,32 @@ namespace raven_integration
|
|||||||
//RETRIEVE
|
//RETRIEVE
|
||||||
//Get one
|
//Get one
|
||||||
ApiResponse a = await Util.GetAsync("FormCustom/widget", await Util.GetTokenAsync("BizAdminFull"));
|
ApiResponse a = await Util.GetAsync("FormCustom/widget", await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
|
||||||
bool Exists = ((int)a.HttpResponse.StatusCode) == 200;
|
bool Exists = ((int)a.HttpResponse.StatusCode) == 200;
|
||||||
|
|
||||||
|
|
||||||
if (Exists)
|
if (Exists)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Update
|
//Update
|
||||||
|
|
||||||
|
|
||||||
//update it
|
|
||||||
d.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
d.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||||
a = await Util.PutAsync("FormCustom/widget", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
a = await Util.PutAsync("FormCustom/widget", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
Util.ValidateHTTPStatusCode(a, 200);
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
// //check PUT worked
|
|
||||||
// a = await Util.GetAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
|
||||||
// Util.ValidateNoErrorInResponse(a);
|
|
||||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Create it
|
//Create it
|
||||||
a = await Util.PostAsync("FormCustom", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
a = await Util.PostAsync("FormCustom", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().StartWith("Test DataFilter");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //CREATE
|
|
||||||
// dynamic d = new JObject();
|
|
||||||
// d.name = Util.Uniquify("Test DataFilter");
|
|
||||||
// // d.ownerId = 1L;
|
|
||||||
// d["public"] = true;
|
|
||||||
// d.listKey = "widget";
|
|
||||||
|
|
||||||
// //"[{fld:"name",op:"!=",value:"Notequaltothis"},{fld:"tags",op:"Eq",value:"[23,456,54]"}]
|
|
||||||
// dynamic dfilter = new JArray();
|
|
||||||
// dynamic df = new JObject();
|
|
||||||
// df.fld = "name";
|
|
||||||
// df.op = "%-";
|
|
||||||
// df.value = "Generic";//lots of seed widgets start with Generic
|
|
||||||
// dfilter.Add(df);
|
|
||||||
|
|
||||||
// d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
|
||||||
|
|
||||||
// a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
|
||||||
// Util.ValidateDataReturnResponseOk(a);
|
|
||||||
|
|
||||||
// long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
|
||||||
|
|
||||||
|
|
||||||
// //RETRIEVE
|
|
||||||
// //Get one
|
|
||||||
// a = await Util.GetAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
|
||||||
// Util.ValidateDataReturnResponseOk(a);
|
|
||||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().StartWith("Test DataFilter");
|
|
||||||
|
|
||||||
// //Get as alternate user should work for public filter
|
|
||||||
// a = await Util.GetAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("SubContractorLimited"));
|
|
||||||
// Util.ValidateDataReturnResponseOk(a);
|
|
||||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().StartWith("Test DataFilter");
|
|
||||||
|
|
||||||
|
|
||||||
// //UPDATE
|
|
||||||
|
|
||||||
// //PUT, make private
|
|
||||||
// d["public"] = false;
|
|
||||||
// d.name = Util.Uniquify("Put - Test DataFilter (privatized)");
|
|
||||||
// d.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
|
||||||
// a = await Util.PutAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
|
||||||
// Util.ValidateHTTPStatusCode(a, 200);
|
|
||||||
|
|
||||||
// //check PUT worked
|
|
||||||
// a = await Util.GetAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
|
||||||
// Util.ValidateNoErrorInResponse(a);
|
|
||||||
// a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
// //FETCH DISALLOWED
|
|
||||||
// //Get as alternate user should fail for private filter
|
|
||||||
// a = await Util.GetAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("SubContractorLimited"));
|
|
||||||
// Util.ValidateResponseNotFound(a);
|
|
||||||
|
|
||||||
// // //DELETE
|
|
||||||
// ApiResponse DELETETestResponse = await Util.DeleteAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
|
||||||
// Util.ValidateHTTPStatusCode(DELETETestResponse, 204);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact]
|
[Fact]
|
||||||
public async void InvalidAvailableFieldsFormKeyShouldFail()
|
public async void InvalidAvailableFieldsFormKeyShouldFail()
|
||||||
{
|
{
|
||||||
|
|
||||||
ApiResponse a = await Util.GetAsync("FormCustom/AvailableFields/nonexistent", await Util.GetTokenAsync("BizAdminFull"));
|
ApiResponse a = await Util.GetAsync("FormCustom/AvailableFields/nonexistent", await Util.GetTokenAsync("BizAdminFull"));
|
||||||
Util.ValidateErrorCodeResponse(a, 2010, 404);
|
Util.ValidateErrorCodeResponse(a, 2010, 404);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -169,11 +87,9 @@ namespace raven_integration
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async void AvailableFieldsWorks()
|
public async void AvailableFieldsWorks()
|
||||||
{
|
{
|
||||||
|
|
||||||
ApiResponse a = await Util.GetAsync("FormCustom/AvailableFields/widget", await Util.GetTokenAsync("BizAdminFull"));
|
ApiResponse a = await Util.GetAsync("FormCustom/AvailableFields/widget", await Util.GetTokenAsync("BizAdminFull"));
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(25);
|
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(25);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user