This commit is contained in:
@@ -20,7 +20,7 @@ namespace raven_integration
|
||||
//CREATE
|
||||
dynamic d = new JObject();
|
||||
d.name = Util.Uniquify("Test DataFilter");
|
||||
// d.ownerId = 1L;
|
||||
// d.ownerId = 1L;
|
||||
d["public"] = true;
|
||||
d.listKey = "Widget";
|
||||
|
||||
@@ -32,45 +32,34 @@ namespace raven_integration
|
||||
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
|
||||
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||
|
||||
ApiResponse a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
string Name = a.ObjectResponse["data"]["name"].Value<string>();
|
||||
Name.Should().StartWith("Test DataFilter");
|
||||
|
||||
|
||||
// // //RETRIEVE
|
||||
// // /*
|
||||
// // {
|
||||
// // "data": {
|
||||
// // "id": 24,
|
||||
// // "created": "2018-03-28T21:07:41.9703503Z",
|
||||
// // "concurrencyToken": 9502,
|
||||
// // "ownerId": 1,
|
||||
// // "name": "یونیکُد چیست؟"
|
||||
// // }
|
||||
// // }
|
||||
// // */
|
||||
// // //Get one
|
||||
// // a = await Util.GetAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
// // Util.ValidateDataReturnResponseOk(a);
|
||||
// // a.ObjectResponse["data"]["name"].Value<string>().Should().StartWith("testtag");
|
||||
//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");
|
||||
|
||||
// // //UPDATE
|
||||
|
||||
// // //PUT
|
||||
// // d.Id = tagId;
|
||||
// // d.name = Util.Uniquify("PutTestTag");
|
||||
// // d.created = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
|
||||
// // d.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
// // d.OwnerId = 1L;
|
||||
//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");
|
||||
|
||||
|
||||
// // ApiResponse PUTTestResponse = await Util.PutAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
// // Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
//UPDATE
|
||||
|
||||
//PUT, make private
|
||||
d["public"] = false;
|
||||
d.name = Util.Uniquify("Put - Test DataFilter (privatized)");
|
||||
d.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("DataFilter/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
// // //check PUT worked
|
||||
// // ApiResponse checkPUTWorked = await Util.GetAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
|
||||
Reference in New Issue
Block a user