Changed api response "result" to "data"
This commit is contained in:
@@ -15,36 +15,7 @@ function json(response) {
|
||||
}
|
||||
|
||||
export default {
|
||||
authenticate(login, password, cb) {
|
||||
fetch(ayconfig.apiUrl + "auth", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
login: login,
|
||||
password: password
|
||||
})
|
||||
})
|
||||
.then(status)
|
||||
.then(json)
|
||||
.then(function(data) {
|
||||
console.log(
|
||||
"AUTH.JS::authenticate() -> Request succeeded with JSON response",
|
||||
data
|
||||
);
|
||||
cb(data);
|
||||
//return data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log("Request failed", error);
|
||||
cb(error); //sb cb(data,error or something)
|
||||
//return error;
|
||||
});
|
||||
},
|
||||
async authenticatepromise(login, password) {
|
||||
async authenticate(login, password) {
|
||||
return fetch(ayconfig.apiUrl + "auth", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
@@ -60,14 +31,14 @@ export default {
|
||||
.then(status)
|
||||
.then(json)
|
||||
.then(function(data) {
|
||||
console.log(
|
||||
"AUTH.JS::authenticatepromise() -> Request succeeded with JSON response",
|
||||
data
|
||||
);
|
||||
// console.log(
|
||||
// "AUTH.JS::authenticatepromise() -> Request succeeded with JSON response",
|
||||
// data
|
||||
// );
|
||||
return data;
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log("AUTH.JS::authenticatepromise() -> Request failed", error);
|
||||
// console.log("AUTH.JS::authenticatepromise() -> Request failed", error);
|
||||
//return error;
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
@@ -22,12 +22,19 @@ export default {
|
||||
methods: {
|
||||
login() {
|
||||
if (this.input.username != "" && this.input.password != "") {
|
||||
auth.authenticate(this.input.username, this.input.password, function(
|
||||
data
|
||||
) {
|
||||
// eslint-disable-next-line
|
||||
console.log("LOGIN.VUE::login() -> CB VERSION DATA:", data);
|
||||
});
|
||||
auth
|
||||
.authenticate(this.input.username, this.input.password)
|
||||
.then(response => {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
"LOGIN.VUE::login() -> SUCCESS",
|
||||
response
|
||||
);
|
||||
})
|
||||
.catch(function(error) {
|
||||
// eslint-disable-next-line
|
||||
console.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
|
||||
});
|
||||
|
||||
// if (
|
||||
// this.input.username == this.$store.state.mockAccount.username &&
|
||||
@@ -40,20 +47,6 @@ export default {
|
||||
// }
|
||||
// } else {
|
||||
// alert("A username and password must be present");
|
||||
|
||||
auth
|
||||
.authenticatepromise(this.input.username, this.input.password)
|
||||
.then(response => {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
"LOGIN.VUE::login() -> PROMISE VERSION RESPONSE:",
|
||||
response
|
||||
);
|
||||
})
|
||||
.catch(function(error) {
|
||||
// eslint-disable-next-line
|
||||
console.log("LOGIN.VUE::login() !CATCH! -> Request failed", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ All successful GET responses have a standard format:
|
||||
|
||||
```json
|
||||
{
|
||||
"Result": {
|
||||
"data": {
|
||||
"id": 150,
|
||||
"name": "Handmade Rubber Pizza",
|
||||
...etc...
|
||||
@@ -21,7 +21,7 @@ All successful GET responses have a standard format:
|
||||
}
|
||||
```
|
||||
|
||||
The results of the response are always contained in the `result` property and could be a single object, a collection or in some cases nothing at all.
|
||||
The results of the response are always contained in the `data` property and could be a single object, a collection or in some cases nothing at all.
|
||||
HTTP Status Code is set in the header.
|
||||
|
||||
### GET COLLECTION RESPONSE
|
||||
@@ -38,7 +38,7 @@ Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"result": [
|
||||
"data": [
|
||||
...collection...
|
||||
],
|
||||
"paging": {
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
public class ApiCreatedResponse
|
||||
{
|
||||
|
||||
public object Result { get; }
|
||||
public object Data { get; }
|
||||
|
||||
public ApiCreatedResponse(object result)
|
||||
{
|
||||
Result = result;
|
||||
Data = result;
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
public class ApiOkResponse
|
||||
{
|
||||
|
||||
public object Result { get; }
|
||||
public object Data { get; }
|
||||
|
||||
public ApiOkResponse(object result)
|
||||
{
|
||||
Result = result;
|
||||
Data = result;
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
@@ -8,22 +8,15 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
public class ApiOkWithPagingResponse<T>
|
||||
{
|
||||
|
||||
public object Result { get; }
|
||||
public object Data { get; }
|
||||
public object Paging { get; }
|
||||
|
||||
public ApiOkWithPagingResponse(ApiPagedResponse<T> pr)
|
||||
{
|
||||
Result = pr.items;
|
||||
Data = pr.items;
|
||||
Paging = pr.PageLinks;
|
||||
|
||||
}
|
||||
|
||||
// public ApiOkWithPagingResponse(object result, AyaNova.Models.PaginationLinkBuilder lb)
|
||||
// {
|
||||
// Result = result;
|
||||
// Paging = lb.PagingData();
|
||||
|
||||
// }
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("BuildMode")]
|
||||
public ActionResult BuildMode()
|
||||
{
|
||||
return Ok(new { result = new { BuildMode = "DEBUG" } });
|
||||
return Ok(new { data = new { BuildMode = "DEBUG" } });
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
@@ -96,7 +96,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("BuildMode")]
|
||||
public ActionResult BuildMode()
|
||||
{
|
||||
return Ok(new { result = new { BuildMode = "RELEASE" } });
|
||||
return Ok(new { data = new { BuildMode = "RELEASE" } });
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
long lTestPngAttachmentId = a.ObjectResponse["result"][0]["id"].Value<long>();
|
||||
long lTestZipAttachmentId = a.ObjectResponse["result"][1]["id"].Value<long>();
|
||||
long lTestPngAttachmentId = a.ObjectResponse["data"][0]["id"].Value<long>();
|
||||
long lTestZipAttachmentId = a.ObjectResponse["data"][1]["id"].Value<long>();
|
||||
|
||||
//saw negative values on a db issue that I corrected (I think)
|
||||
//Keeping these in case it arises again, if it does, see log, it's a db error with async issue of some kind
|
||||
@@ -61,14 +61,14 @@ namespace raven_integration
|
||||
|
||||
//Get the inventoryfull account download token
|
||||
// {
|
||||
// "result": {
|
||||
// "data": {
|
||||
// "dlkey": "w7iE1cXF8kOxo8eomd1r8A",
|
||||
// "expires": "2018-04-25T23:45:39.05665"
|
||||
// }
|
||||
// }
|
||||
a = await Util.GetAsync("Attachment/DownloadToken", await Util.GetTokenAsync("InventoryFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
string downloadToken = a.ObjectResponse["result"]["dlkey"].Value<string>();
|
||||
string downloadToken = a.ObjectResponse["data"]["dlkey"].Value<string>();
|
||||
|
||||
//now get the file https://rockfish.ayanova.com/api/rfcaseblob/download/248?dlkey=9O2eDAAlZ0Wknj19SBK2iA
|
||||
var dlresponse = await Util.DownloadFileAsync("Attachment/Download/" + lTestZipAttachmentId.ToString() + "?dlkey=" + downloadToken, await Util.GetTokenAsync("InventoryFull"));
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 8 of them (at time of writing late March 2018)
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(8);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterOrEqualTo(8);
|
||||
|
||||
//Number 2 is widget and list is zero based so confirm:
|
||||
a.ObjectResponse["result"][2]["id"].Value<long>().Should().Be(2);
|
||||
a.ObjectResponse["result"][2]["name"].Value<string>().Should().Be("Widget [Attachable] [Taggable]");
|
||||
a.ObjectResponse["data"][2]["id"].Value<long>().Should().Be(2);
|
||||
a.ObjectResponse["data"][2]["name"].Value<string>().Should().Be("Widget [Attachable] [Taggable]");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
long w2Id = r2.ObjectResponse["result"]["id"].Value<long>();
|
||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
ApiResponse EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
@@ -42,29 +42,29 @@ namespace raven_integration
|
||||
//might have been some temporary bad code in the seeder at one point when I was experimenting with async stuff
|
||||
|
||||
|
||||
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(1);//only one event so far
|
||||
EventLogResponse.ObjectResponse["result"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["result"][0]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["result"][0]["event"].Value<int>().Should().Be(1);//AyEvent 1 = created
|
||||
EventLogResponse.ObjectResponse["result"][0]["textra"].Should().BeNullOrEmpty();
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().Be(1);//only one event so far
|
||||
EventLogResponse.ObjectResponse["data"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["data"][0]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["data"][0]["event"].Value<int>().Should().Be(1);//AyEvent 1 = created
|
||||
EventLogResponse.ObjectResponse["data"][0]["textra"].Should().BeNullOrEmpty();
|
||||
|
||||
//Get current user doing modifications ID
|
||||
long CurrentUserId = EventLogResponse.ObjectResponse["result"][0]["userId"].Value<long>();
|
||||
long CurrentUserId = EventLogResponse.ObjectResponse["data"][0]["userId"].Value<long>();
|
||||
|
||||
//RETRIEVE
|
||||
|
||||
//Get one
|
||||
ApiResponse r3 = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
Util.ValidateDataReturnResponseOk(r3);
|
||||
r3.ObjectResponse["result"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
r3.ObjectResponse["data"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
|
||||
EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
EventLogResponse.ObjectResponse["result"][1]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["result"][1]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["result"][1]["event"].Value<int>().Should().Be(2);//AyEvent 2 = retrieved
|
||||
EventLogResponse.ObjectResponse["result"][1]["textra"].Should().BeNullOrEmpty();
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().Be(2);
|
||||
EventLogResponse.ObjectResponse["data"][1]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["data"][1]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["data"][1]["event"].Value<int>().Should().Be(2);//AyEvent 2 = retrieved
|
||||
EventLogResponse.ObjectResponse["data"][1]["textra"].Should().BeNullOrEmpty();
|
||||
|
||||
|
||||
|
||||
@@ -74,29 +74,29 @@ namespace raven_integration
|
||||
//update w2id
|
||||
w.name = Util.Uniquify("UPDATED VIA PUT EVENTLOG TEST WIDGET");
|
||||
w.OwnerId = 1;
|
||||
w.concurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
w.concurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"), w.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(4);
|
||||
EventLogResponse.ObjectResponse["result"][2]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["result"][2]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["result"][2]["event"].Value<int>().Should().Be(3);//AyEvent 3 = Modified
|
||||
EventLogResponse.ObjectResponse["result"][2]["textra"].Should().BeNullOrEmpty();
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().Be(4);
|
||||
EventLogResponse.ObjectResponse["data"][2]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["data"][2]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["data"][2]["event"].Value<int>().Should().Be(3);//AyEvent 3 = Modified
|
||||
EventLogResponse.ObjectResponse["data"][2]["textra"].Should().BeNullOrEmpty();
|
||||
|
||||
|
||||
//Check user log for basic accessibility
|
||||
EventLogResponse = await Util.GetAsync($"EventLog/UserLog?AyType=3&AyId={CurrentUserId}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(4);//just one run of the above will be 4 events plus any others from other tests
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().BeGreaterOrEqualTo(4);//just one run of the above will be 4 events plus any others from other tests
|
||||
//Not sure of any easy way to assert the User log is correct other than the count as other tests running concurrently could easily skew this
|
||||
|
||||
|
||||
@@ -107,11 +107,11 @@ namespace raven_integration
|
||||
//All events should be cleared up on deletion with the sole exception of the deleted event
|
||||
EventLogResponse = await Util.GetAsync($"EventLog/ObjectLog?AyType=2&AyId={w2Id}", await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(EventLogResponse, 200);
|
||||
((JArray)EventLogResponse.ObjectResponse["result"]).Count.Should().Be(1);
|
||||
EventLogResponse.ObjectResponse["result"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["result"][0]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["result"][0]["event"].Value<int>().Should().Be(0);//AyEvent 0 = deleted
|
||||
EventLogResponse.ObjectResponse["result"][0]["textra"].Value<string>().Should().Be(w.name.ToString());
|
||||
((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().Be(1);
|
||||
EventLogResponse.ObjectResponse["data"][0]["date"].Value<DateTime>().Should().BeLessThan(new TimeSpan(1, 0, 0)).Before(DateTime.UtcNow);//should be less than one hour before now
|
||||
EventLogResponse.ObjectResponse["data"][0]["userId"].Should().NotBeNull();
|
||||
EventLogResponse.ObjectResponse["data"][0]["event"].Value<int>().Should().Be(0);//AyEvent 0 = deleted
|
||||
EventLogResponse.ObjectResponse["data"][0]["textra"].Value<string>().Should().Be(w.name.ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace raven_integration
|
||||
ApiResponse a = await Util.PostFormDataAsync("ImportAyaNova7", formDataContent, await Util.GetTokenAsync("OpsAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
string importFileName = a.ObjectResponse["result"][0].Value<string>();
|
||||
string importFileName = a.ObjectResponse["data"][0].Value<string>();
|
||||
importFileName.Should().Be(UploadFileName);
|
||||
|
||||
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace raven_integration
|
||||
|
||||
|
||||
//there should be at least 1
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
|
||||
//See if our job is in there
|
||||
bool bFound=false;
|
||||
foreach(JToken t in a.ObjectResponse["result"])
|
||||
foreach(JToken t in a.ObjectResponse["data"])
|
||||
{
|
||||
if(t["gId"].Value<String>()==jobId)
|
||||
bFound=true;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 4 of them as there are 4 stock locales
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterThan(3);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(3);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
||||
((JArray)a.ObjectResponse["result"]["localeItems"]).Count.Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["data"]["localeItems"]).Count.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().Be(4);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(4);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,13 +88,13 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 201);
|
||||
//verify the object returned is as expected
|
||||
a.ObjectResponse["result"]["name"].Value<string>().Should().Be(d.name.ToString());
|
||||
a.ObjectResponse["result"]["stock"].Value<bool>().Should().Be(false);
|
||||
a.ObjectResponse["result"]["id"].Value<long>().Should().BeGreaterThan(4);
|
||||
a.ObjectResponse["result"]["concurrencyToken"].Value<uint>().Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["result"]["localeItems"]).Count.Should().BeGreaterThan(0);
|
||||
a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
||||
a.ObjectResponse["data"]["stock"].Value<bool>().Should().Be(false);
|
||||
a.ObjectResponse["data"]["id"].Value<long>().Should().BeGreaterThan(4);
|
||||
a.ObjectResponse["data"]["concurrencyToken"].Value<uint>().Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["data"]["localeItems"]).Count.Should().BeGreaterThan(0);
|
||||
|
||||
long NewId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long NewId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//UPDATE
|
||||
//Update locale name
|
||||
@@ -111,19 +111,19 @@ namespace raven_integration
|
||||
dynamic d2 = new JObject();
|
||||
d2.id = NewId;
|
||||
d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALE NAME UPDATE");
|
||||
d2.concurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
d2.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Locale/UpdateLocaleName", await Util.GetTokenAsync("BizAdminFull"), d2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("Locale/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(d2.newText.ToString());
|
||||
//uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(d2.newText.ToString());
|
||||
//uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//Update locale key
|
||||
var FirstLocaleKey = ((JArray)a.ObjectResponse["result"]["localeItems"])[0];
|
||||
var FirstLocaleKey = ((JArray)a.ObjectResponse["data"]["localeItems"])[0];
|
||||
long UpdatedLocaleKeyId = FirstLocaleKey["id"].Value<long>();
|
||||
d2.id = UpdatedLocaleKeyId;
|
||||
d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALEITEM DISPLAY UPDATE");
|
||||
@@ -143,8 +143,8 @@ namespace raven_integration
|
||||
checkPUTWorked = await Util.PostAsync("Locale/subset", await Util.GetTokenAsync("ClientLimited"), d3.ToString());
|
||||
Util.ValidateDataReturnResponseOk(checkPUTWorked);
|
||||
Util.ValidateHTTPStatusCode(checkPUTWorked, 200);
|
||||
((JArray)checkPUTWorked.ObjectResponse["result"]).Count.Should().Be(1);
|
||||
var FirstLocaleKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["result"])[0];
|
||||
((JArray)checkPUTWorked.ObjectResponse["data"]).Count.Should().Be(1);
|
||||
var FirstLocaleKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["data"])[0];
|
||||
|
||||
FirstLocaleKeyUpdated["value"].Value<string>().Should().Be(d2.newText.ToString());
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace raven_integration
|
||||
//And doesn't exists if server was not debug built
|
||||
ApiResponse a = await Util.GetAsync("BuildMode");
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var BuildMode = a.ObjectResponse["result"]["buildMode"].Value<string>();
|
||||
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
|
||||
BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" }));
|
||||
|
||||
if (BuildMode == "DEBUG")
|
||||
@@ -38,21 +38,21 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(2);
|
||||
|
||||
//Now ensure there are at least two keys in the fetched keys array
|
||||
a = await Util.GetAsync("Locale/LocaleKeyCoverage", await Util.GetTokenAsync("ClientLimited"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
var RequestedKeyCount = a.ObjectResponse["result"]["requestedKeyCount"].Value<int>();
|
||||
var RequestedKeyCount = a.ObjectResponse["data"]["requestedKeyCount"].Value<int>();
|
||||
RequestedKeyCount.Should().BeGreaterOrEqualTo(2);
|
||||
var NotRequestedKeyCount = a.ObjectResponse["result"]["notRequestedKeyCount"].Value<int>();
|
||||
var NotRequestedKeyCount = a.ObjectResponse["data"]["notRequestedKeyCount"].Value<int>();
|
||||
NotRequestedKeyCount.Should().BeGreaterThan(1);//For now at least, once we have this dialed in it will be zero ultimately
|
||||
|
||||
//there should be dozens of keys but at times there might only be a few during development so at least verify there is more than one
|
||||
((JArray)a.ObjectResponse["result"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
||||
((JArray)a.ObjectResponse["result"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
||||
((JArray)a.ObjectResponse["data"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
||||
((JArray)a.ObjectResponse["data"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace raven_integration
|
||||
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
a.ObjectResponse["result"]["timestamp"].Should().NotBeNull();
|
||||
((JArray)a.ObjectResponse["result"]["contexts"]).Count.Should().BeGreaterThan(0);
|
||||
a.ObjectResponse["data"]["timestamp"].Should().NotBeNull();
|
||||
((JArray)a.ObjectResponse["data"]["contexts"]).Count.Should().BeGreaterThan(0);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
@@ -42,7 +42,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE A SECOND TEST USER WITH PHRASE IN NOTES
|
||||
D = new JObject();
|
||||
@@ -58,7 +58,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE A SECOND WIDGET
|
||||
D = new JObject();
|
||||
@@ -70,7 +70,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE A THIRD WIDGET
|
||||
D = new JObject();
|
||||
@@ -82,7 +82,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchNothingWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchNothingWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
@@ -96,10 +96,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(3);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(3);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
@@ -115,10 +115,10 @@ namespace raven_integration
|
||||
|
||||
//Assert the order (roughly, this is kind of a waste of time, either the code is sorting or not, it's not going to change)
|
||||
//first item must be a widget
|
||||
a.ObjectResponse["result"]["searchResults"][0]["type"].Value<int>().Should().Be(2);
|
||||
a.ObjectResponse["data"]["searchResults"][0]["type"].Value<int>().Should().Be(2);
|
||||
|
||||
//final item must be a user
|
||||
a.ObjectResponse["result"]["searchResults"][MatchingIdList.Count - 1]["type"].Value<int>().Should().Be(3);
|
||||
a.ObjectResponse["data"]["searchResults"][MatchingIdList.Count - 1]["type"].Value<int>().Should().Be(3);
|
||||
|
||||
|
||||
//FULL BODY SEARCH RIGHTS
|
||||
@@ -130,7 +130,7 @@ namespace raven_integration
|
||||
//This search should return zero items
|
||||
a = await Util.PostAsync("Search", await Util.GetTokenAsync("SubContractorLimited"), SearchParameters.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().Be(0, "User with no rights should not see any results in body search");
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().Be(0, "User with no rights should not see any results in body search");
|
||||
|
||||
|
||||
//NAME ONLY SEARCH SHOULD WORK WITH NO RIGHTS TO READ FULL RECORD
|
||||
@@ -142,10 +142,10 @@ namespace raven_integration
|
||||
SearchParameters.maxResults=0;
|
||||
a = await Util.PostAsync("Search", await Util.GetTokenAsync("SubContractorLimited"), SearchParameters.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
//Check that list does *not* include the notes only records
|
||||
MatchingIdList = new List<long>();
|
||||
v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
MatchingIdList.Add(j["id"].Value<long>());
|
||||
@@ -175,7 +175,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
@@ -191,7 +191,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
@@ -205,10 +205,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
@@ -237,7 +237,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
@@ -253,7 +253,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
@@ -267,10 +267,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
@@ -317,7 +317,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
@@ -331,10 +331,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
@@ -358,7 +358,7 @@ namespace raven_integration
|
||||
D.name = Util.Uniquify("TAGSEARCH");
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long TagId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TagId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE A WIDGET
|
||||
@@ -371,7 +371,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//TAG the widget with the fresh tag
|
||||
D = new JObject();
|
||||
@@ -392,7 +392,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long NoPhraseMatchWidgetInTagId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long NoPhraseMatchWidgetInTagId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//TAG the tag only no phrase with the fresh tag
|
||||
D = new JObject();
|
||||
@@ -418,7 +418,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
@@ -433,10 +433,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
@@ -477,14 +477,14 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
var ResultCount = ((JArray)a.ObjectResponse["result"]["searchResults"]).Count;
|
||||
var ResultCount = ((JArray)a.ObjectResponse["data"]["searchResults"]).Count;
|
||||
//assert it's not unbounded
|
||||
ResultCount.Should().BeLessOrEqualTo(1000);
|
||||
|
||||
if (ResultCount > 999)
|
||||
{
|
||||
//assert the TotalResultsFound is greater than the results returned
|
||||
var TotalResultsFound = a.ObjectResponse["result"]["totalResultsFound"].Value<long>();
|
||||
var TotalResultsFound = a.ObjectResponse["data"]["totalResultsFound"].Value<long>();
|
||||
//assert it's not unbounded
|
||||
TotalResultsFound.Should().BeGreaterThan(ResultCount);
|
||||
}
|
||||
@@ -519,7 +519,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
var ResultCount = ((JArray)a.ObjectResponse["result"]["searchResults"]).Count;
|
||||
var ResultCount = ((JArray)a.ObjectResponse["data"]["searchResults"]).Count;
|
||||
|
||||
|
||||
//Set this time based on testing. 52385 Slowest run plus 10%
|
||||
@@ -543,8 +543,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchWidgetInSerialId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
var MatchWidgetSerial = a.ObjectResponse["result"]["serial"].Value<uint>();
|
||||
long MatchWidgetInSerialId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
var MatchWidgetSerial = a.ObjectResponse["data"]["serial"].Value<uint>();
|
||||
|
||||
//TODO: get this from the return object
|
||||
string SerialSearch=MatchWidgetInSerialId.ToString();;
|
||||
@@ -560,10 +560,10 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
//Now validate the return list
|
||||
((JArray)a.ObjectResponse["result"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(1);
|
||||
|
||||
//Turn the list into an array of id's
|
||||
var v = ((JArray)a.ObjectResponse["result"]["searchResults"]);
|
||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||
List<long> MatchingIdList = new List<long>();
|
||||
foreach (JObject j in v)
|
||||
{
|
||||
|
||||
@@ -30,15 +30,15 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), w1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long tagId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
string tagName = a.ObjectResponse["result"]["name"].Value<string>();
|
||||
long tagId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
string tagName = a.ObjectResponse["data"]["name"].Value<string>();
|
||||
tagName.Should().StartWith("testtag");
|
||||
|
||||
|
||||
//RETRIEVE
|
||||
/*
|
||||
{
|
||||
"result": {
|
||||
"data": {
|
||||
"id": 24,
|
||||
"created": "2018-03-28T21:07:41.9703503Z",
|
||||
"concurrencyToken": 9502,
|
||||
@@ -50,7 +50,7 @@ namespace raven_integration
|
||||
//Get one
|
||||
a = await Util.GetAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
a.ObjectResponse["result"]["name"].Value<string>().Should().StartWith("testtag");
|
||||
a.ObjectResponse["data"]["name"].Value<string>().Should().StartWith("testtag");
|
||||
|
||||
//UPDATE
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace raven_integration
|
||||
w1.Id = tagId;
|
||||
w1.name = Util.Uniquify("PutTestTag");
|
||||
w1.created = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
|
||||
w1.concurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
w1.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
w1.OwnerId = 1L;
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace raven_integration
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(w1.name.ToString().ToLowerInvariant().Replace(" ", "-"));
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w1.name.ToString().ToLowerInvariant().Replace(" ", "-"));
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//PATCH
|
||||
var newName = Util.Uniquify("PatchUpdate");
|
||||
@@ -80,7 +80,7 @@ namespace raven_integration
|
||||
//check PATCH worked
|
||||
ApiResponse checkPATCHWorked = await Util.GetAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateNoErrorInResponse(checkPATCHWorked);
|
||||
checkPATCHWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(newName.ToLowerInvariant().Replace(" ", "-"));
|
||||
checkPATCHWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(newName.ToLowerInvariant().Replace(" ", "-"));
|
||||
|
||||
// //DELETE
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
|
||||
@@ -24,14 +24,14 @@ namespace raven_integration
|
||||
D.name = Util.Uniquify("test-tag1-4-tag-group");
|
||||
ApiResponse R = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TestTag1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TestTag1Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE TAG2
|
||||
D.name = Util.Uniquify("test-tag2-4-tag-group");
|
||||
R = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TestTag2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TestTag2Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE TAG-GROUP
|
||||
@@ -40,7 +40,7 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("TagGroup", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TestTagGroupId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TestTagGroupId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//ADD TEST TAGS TO GROUP
|
||||
@@ -76,7 +76,7 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long WidgetId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long WidgetId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("TagGroup/TagObject", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
((JArray)R.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
((JArray)R.ObjectResponse["data"]).Count.Should().Be(2);
|
||||
|
||||
|
||||
//VALIDATE HAS TAGS FROM GROUP
|
||||
@@ -107,7 +107,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
Util.ValidateHTTPStatusCode(R, 200);
|
||||
//there should be 2 of them
|
||||
((JArray)R.ObjectResponse["result"]).Count.Should().Be(2);
|
||||
((JArray)R.ObjectResponse["data"]).Count.Should().Be(2);
|
||||
|
||||
|
||||
//DELETE TAG-GROUP
|
||||
|
||||
@@ -27,32 +27,32 @@ namespace raven_integration
|
||||
d.name = Util.Uniquify("Apple");
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("Applesauce");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("Apple-Tar-Tar");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("Apple-Tini");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("Apple-Pie");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("AppleJack");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
|
||||
//Get all
|
||||
@@ -60,7 +60,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 5 of them
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterThan(4);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(4);
|
||||
|
||||
|
||||
//Delete them all here (just a cleanup)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long tagId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long tagId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE WIDGET
|
||||
@@ -43,7 +43,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long widgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long widgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE TAGMAP (tag the widget)
|
||||
/*
|
||||
@@ -61,12 +61,12 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), tm.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long tagMapId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long tagMapId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
a = await Util.GetAsync("TagMap/" + tagMapId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
a.ObjectResponse["result"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
a.ObjectResponse["data"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
|
||||
|
||||
//ATTEMPT TO DELETE TAG THAT HAS TAGMAP SHOULD FAIL with 2200 / 400
|
||||
@@ -108,7 +108,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long tagId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long tagId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE WIDGET
|
||||
@@ -121,7 +121,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long widgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long widgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE TAGMAP (tag the widget)
|
||||
/*
|
||||
@@ -139,12 +139,12 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), tm.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long tagMapId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long tagMapId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
a = await Util.GetAsync("TagMap/" + tagMapId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
a.ObjectResponse["result"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
a.ObjectResponse["data"]["id"].Value<long>().Should().Be(tagMapId);
|
||||
|
||||
|
||||
//DELETE PARENT (WIDGET)
|
||||
@@ -181,27 +181,27 @@ namespace raven_integration
|
||||
d.name = Util.Uniquify("Red");
|
||||
ApiResponse a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("red-green");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("red-rum");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("red-dit");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
d.name = Util.Uniquify("red-tailed-hawk");
|
||||
a = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
createdTagList.Add(a.ObjectResponse["result"]["id"].Value<long>());
|
||||
createdTagList.Add(a.ObjectResponse["data"]["id"].Value<long>());
|
||||
|
||||
|
||||
//Create a widget
|
||||
@@ -214,7 +214,7 @@ namespace raven_integration
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), w.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long widgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long widgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Tag all the tags to the widget
|
||||
@@ -237,7 +237,7 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 5 of them
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(createdTagList.Count);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterOrEqualTo(createdTagList.Count);
|
||||
|
||||
//delete widget (which will delete tagmaps as well)
|
||||
a = await Util.DeleteAsync("Widget/" + widgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
@@ -276,7 +276,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("Tag", await Util.GetTokenAsync("BizAdminFull"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TestTagId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TestTagId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE WIDGET 1
|
||||
@@ -289,7 +289,7 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long Widget1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Widget1Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE WIDGET 2
|
||||
//D2 = new JObject();
|
||||
@@ -301,7 +301,7 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("Widget", await Util.GetTokenAsync("BizAdminFull"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long Widget2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Widget2Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//TAGMAP to Widget 1
|
||||
/*
|
||||
@@ -319,13 +319,13 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), D3.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TagMap1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TagMap1Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
R = await Util.GetAsync("TagMap/" + TagMap1Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
R.ObjectResponse["result"]["id"].Value<long>().Should().Be(TagMap1Id);
|
||||
R.ObjectResponse["result"]["tagToObjectId"].Value<long>().Should().Be(Widget1Id);
|
||||
R.ObjectResponse["data"]["id"].Value<long>().Should().Be(TagMap1Id);
|
||||
R.ObjectResponse["data"]["tagToObjectId"].Value<long>().Should().Be(Widget1Id);
|
||||
|
||||
|
||||
//TAGMAP to Widget 2
|
||||
@@ -336,13 +336,13 @@ namespace raven_integration
|
||||
|
||||
R = await Util.PostAsync("TagMap", await Util.GetTokenAsync("BizAdminFull"), D3.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long TagMap2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long TagMap2Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//VERIFY TAGMAP
|
||||
R = await Util.GetAsync("TagMap/" + TagMap2Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
R.ObjectResponse["result"]["id"].Value<long>().Should().Be(TagMap2Id);
|
||||
R.ObjectResponse["result"]["tagToObjectId"].Value<long>().Should().Be(Widget2Id);
|
||||
R.ObjectResponse["data"]["id"].Value<long>().Should().Be(TagMap2Id);
|
||||
R.ObjectResponse["data"]["tagToObjectId"].Value<long>().Should().Be(Widget2Id);
|
||||
|
||||
//UNTAG-ALL
|
||||
R = await Util.PostAsync("Tag/UntagAll/" + TestTagId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R1 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R1);
|
||||
long d1Id = R1.ObjectResponse["result"]["id"].Value<long>();
|
||||
long d1Id = R1.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
dynamic D2 = new JObject();
|
||||
@@ -44,7 +44,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R2 = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R2);
|
||||
long d2Id = R2.ObjectResponse["result"]["id"].Value<long>();
|
||||
long d2Id = R2.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//RETRIEVE
|
||||
@@ -52,7 +52,7 @@ namespace raven_integration
|
||||
//Get one
|
||||
ApiResponse R3 = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R3);
|
||||
R3.ObjectResponse["result"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
R3.ObjectResponse["data"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
|
||||
|
||||
|
||||
@@ -62,15 +62,15 @@ namespace raven_integration
|
||||
//update w2id
|
||||
D2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST User");
|
||||
D2.OwnerId = 1;
|
||||
D2.concurrencyToken = R2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
D2.concurrencyToken = R2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(D2.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//PATCH
|
||||
var newName = Util.Uniquify("UPDATED VIA PATCH SECOND TEST User");
|
||||
@@ -81,7 +81,7 @@ namespace raven_integration
|
||||
//check PATCH worked
|
||||
ApiResponse checkPATCHWorked = await Util.GetAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateNoErrorInResponse(checkPATCHWorked);
|
||||
checkPATCHWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(newName);
|
||||
checkPATCHWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(newName);
|
||||
|
||||
//DELETE
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + d2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
@@ -133,8 +133,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long D1Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long D1Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//UPDATE
|
||||
@@ -166,8 +166,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long w2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long w2Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//PATCH
|
||||
@@ -198,8 +198,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long w2Id = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long w2Id = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//PATCH attempt on Id
|
||||
@@ -243,8 +243,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long UserId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Test can login
|
||||
dynamic DCreds = new JObject();
|
||||
@@ -288,8 +288,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long UserId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Test can login
|
||||
dynamic DCreds = new JObject();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse R = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
long UserId = R.ObjectResponse["result"]["id"].Value<long>();
|
||||
long UserId = R.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now there should be a user options available for this user
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace raven_integration
|
||||
R = await Util.GetAsync("UserOptions/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["result"]["uiColor"].Value<int>().Should().Be(0);
|
||||
uint concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
R.ObjectResponse["data"]["uiColor"].Value<int>().Should().Be(0);
|
||||
uint concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//UPDATE
|
||||
//PUT
|
||||
@@ -57,10 +57,10 @@ namespace raven_integration
|
||||
R = await Util.GetAsync("UserOptions/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["result"]["emailAddress"].Value<string>().Should().Be(D2.emailaddress.ToString());
|
||||
R.ObjectResponse["result"]["timeZoneOffset"].Value<decimal>().Should().Be((decimal)D2.TimeZoneOffset);
|
||||
R.ObjectResponse["result"]["uiColor"].Value<int>().Should().Be((int)D2.UiColor);
|
||||
concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
R.ObjectResponse["data"]["emailAddress"].Value<string>().Should().Be(D2.emailaddress.ToString());
|
||||
R.ObjectResponse["data"]["timeZoneOffset"].Value<decimal>().Should().Be((decimal)D2.TimeZoneOffset);
|
||||
R.ObjectResponse["data"]["uiColor"].Value<int>().Should().Be((int)D2.UiColor);
|
||||
concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//PATCH
|
||||
@@ -73,10 +73,10 @@ namespace raven_integration
|
||||
R = await Util.GetAsync("UserOptions/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["result"]["emailAddress"].Value<string>().Should().Be(newEmail);
|
||||
R.ObjectResponse["result"]["timeZoneOffset"].Value<decimal>().Should().Be((decimal)D2.TimeZoneOffset);
|
||||
R.ObjectResponse["result"]["uiColor"].Value<int>().Should().Be((int)D2.UiColor);
|
||||
// concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
R.ObjectResponse["data"]["emailAddress"].Value<string>().Should().Be(newEmail);
|
||||
R.ObjectResponse["data"]["timeZoneOffset"].Value<decimal>().Should().Be((decimal)D2.TimeZoneOffset);
|
||||
R.ObjectResponse["data"]["uiColor"].Value<int>().Should().Be((int)D2.UiColor);
|
||||
// concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//DELETE USER
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse r1 = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w1.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r1);
|
||||
long w1Id = r1.ObjectResponse["result"]["id"].Value<long>();
|
||||
long w1Id = r1.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
dynamic w2 = new JObject();
|
||||
@@ -46,7 +46,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
long w2Id = r2.ObjectResponse["result"]["id"].Value<long>();
|
||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//RETRIEVE
|
||||
@@ -54,8 +54,8 @@ namespace raven_integration
|
||||
//Get one
|
||||
ApiResponse r3 = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(r3);
|
||||
r3.ObjectResponse["result"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
||||
r3.ObjectResponse["result"]["notes"].Value<string>().Should().Be(w2.notes.ToString());
|
||||
r3.ObjectResponse["data"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
||||
r3.ObjectResponse["data"]["notes"].Value<string>().Should().Be(w2.notes.ToString());
|
||||
|
||||
|
||||
|
||||
@@ -66,15 +66,15 @@ namespace raven_integration
|
||||
//update w2id
|
||||
w2.name = Util.Uniquify("UPDATED VIA PUT SECOND TEST WIDGET");
|
||||
w2.OwnerId = 1;
|
||||
w2.concurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
w2.concurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
ApiResponse PUTTestResponse = await Util.PutAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//check PUT worked
|
||||
ApiResponse checkPUTWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateNoErrorInResponse(checkPUTWorked);
|
||||
checkPUTWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
checkPUTWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(w2.name.ToString());
|
||||
uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//PATCH
|
||||
var newName = Util.Uniquify("UPDATED VIA PATCH SECOND TEST WIDGET");
|
||||
@@ -85,7 +85,7 @@ namespace raven_integration
|
||||
//check PATCH worked
|
||||
ApiResponse checkPATCHWorked = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateNoErrorInResponse(checkPATCHWorked);
|
||||
checkPATCHWorked.ObjectResponse["result"]["name"].Value<string>().Should().Be(newName);
|
||||
checkPATCHWorked.ObjectResponse["data"]["name"].Value<string>().Should().Be(newName);
|
||||
|
||||
//DELETE
|
||||
ApiResponse DELETETestResponse = await Util.DeleteAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
@@ -168,8 +168,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
long w2Id = r2.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
|
||||
@@ -205,8 +205,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse r2 = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w2.ToString());
|
||||
Util.ValidateDataReturnResponseOk(r2);
|
||||
long w2Id = r2.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long w2Id = r2.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
|
||||
//PATCH
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace raven_integration
|
||||
ApiResponse a = await Util.GetAsync("Widget/picklist?Offset=2&Limit=3&q=%25of%25", await Util.GetTokenAsync( "InventoryLimited"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace raven_integration
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
//assert aAll contains at least two records
|
||||
((JArray)a.ObjectResponse["result"]).Count.Should().Be(3);
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||
|
||||
JObject jp = (JObject)a.ObjectResponse["paging"];
|
||||
jp["count"].Value<long>().Should().BeGreaterThan(5);
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "TechFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Now attempt to modify it via patch
|
||||
var newName = Util.Uniquify("ServerShouldAllowOwnerOnlyRightsUserToPatchOwn - UPDATED TEST WIDGET");
|
||||
@@ -108,8 +108,8 @@ namespace raven_integration
|
||||
//create via inventory full test user
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Now TechFullAuthToken attempt to modify it via patch
|
||||
var newName = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToPatchNonOwned - UPDATED TEST WIDGETB");
|
||||
@@ -144,8 +144,8 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "TechFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value<uint>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value<uint>();
|
||||
|
||||
//Now attempt to modify it via patch
|
||||
var newName = Util.Uniquify("ServerShouldAllowOwnerOnlyRightsUserToPutOwn - UPDATED TEST WIDGET");
|
||||
@@ -178,7 +178,7 @@ namespace raven_integration
|
||||
//create via inventory full test user
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now TechFullAuthToken attempt to modify it via patch
|
||||
var newName = Util.Uniquify("ServerShouldDisAllowOwnerOnlyRightsUserToPutNonOwned - UPDATED TEST WIDGET");
|
||||
@@ -211,7 +211,7 @@ namespace raven_integration
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "TechFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now attempt to delete it
|
||||
a = await Util.DeleteAsync("Widget/" + Id.ToString(), await Util.GetTokenAsync( "TechFull"));
|
||||
@@ -241,7 +241,7 @@ namespace raven_integration
|
||||
//create via inventory full test user
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now attempt delete
|
||||
a = await Util.DeleteAsync("Widget/" + Id.ToString(), await Util.GetTokenAsync( "TechFull"));
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace raven_integration
|
||||
//create via inventory full test user
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync( "InventoryFull"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long Id = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
long Id = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//Now put a change with no ownerId set
|
||||
d.active = false;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace raven_integration
|
||||
//Put this in when having concurrency issue during auth and old style dl token creation during login
|
||||
ValidateDataReturnResponseOk(a);
|
||||
|
||||
authDict[login] = a.ObjectResponse["result"]["token"].Value<string>();
|
||||
authDict[login] = a.ObjectResponse["data"]["token"].Value<string>();
|
||||
}
|
||||
return authDict[login];
|
||||
}
|
||||
@@ -253,7 +253,7 @@ namespace raven_integration
|
||||
}
|
||||
|
||||
a.ObjectResponse["error"].Should().BeNull("because there should not be an error on an api call, error was: {0}", ErrorMessage);
|
||||
a.ObjectResponse["result"].Should().NotBeNull("A result should be returned");
|
||||
a.ObjectResponse["data"].Should().NotBeNull("A result should be returned");
|
||||
}
|
||||
|
||||
public static void ValidateNoErrorInResponse(ApiResponse a)
|
||||
|
||||
Reference in New Issue
Block a user