From 6c7376f2e89aba381ff7cfb9d779f660ccf01d61 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 7 Nov 2018 16:05:21 +0000 Subject: [PATCH] Changed api response "result" to "data" --- app/ayanova/src/api/auth.js | 41 ++-------- app/ayanova/src/views/login.vue | 33 ++++----- docs/8.0/ayanova/docs/api-response-format.md | 6 +- .../ControllerHelpers/ApiCreatedResponse.cs | 4 +- .../ControllerHelpers/ApiOkResponse.cs | 4 +- .../ApiOkWithPagingResponse.cs | 13 +--- .../AyaNova/Controllers/ApiRootController.cs | 4 +- .../Attachments/AttachmentTest.cs | 8 +- test/raven-integration/AyaType/AyaType.cs | 6 +- test/raven-integration/EventLog/EventLog.cs | 54 +++++++------- test/raven-integration/ImportV7/ImportV7.cs | 2 +- .../JobOperations/JobOperations.cs | 4 +- test/raven-integration/Locale/Locale.cs | 30 ++++---- .../Locale/RequestedLocaleKeys.cs | 12 +-- test/raven-integration/Metrics/Metrics.cs | 4 +- test/raven-integration/Search/SearchOps.cs | 74 +++++++++---------- test/raven-integration/Tags/TagCrud.cs | 16 ++-- test/raven-integration/Tags/TagGroupOps.cs | 12 +-- test/raven-integration/Tags/TagLists.cs | 14 ++-- test/raven-integration/Tags/TagMapOps.cs | 48 ++++++------ test/raven-integration/User/UserCrud.cs | 34 ++++----- test/raven-integration/User/UserOptionsRu.cs | 22 +++--- test/raven-integration/Widget/WidgetCrud.cs | 24 +++--- test/raven-integration/Widget/WidgetLists.cs | 4 +- test/raven-integration/Widget/WidgetRights.cs | 18 ++--- .../Widget/WidgetValidationTests.cs | 2 +- test/raven-integration/util.cs | 4 +- 27 files changed, 227 insertions(+), 270 deletions(-) diff --git a/app/ayanova/src/api/auth.js b/app/ayanova/src/api/auth.js index 2c68fef3..cde77a8f 100644 --- a/app/ayanova/src/api/auth.js +++ b/app/ayanova/src/api/auth.js @@ -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); }); diff --git a/app/ayanova/src/views/login.vue b/app/ayanova/src/views/login.vue index a8b37f76..3b285978 100644 --- a/app/ayanova/src/views/login.vue +++ b/app/ayanova/src/views/login.vue @@ -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); - }); } } } diff --git a/docs/8.0/ayanova/docs/api-response-format.md b/docs/8.0/ayanova/docs/api-response-format.md index 671fc584..667ba869 100644 --- a/docs/8.0/ayanova/docs/api-response-format.md +++ b/docs/8.0/ayanova/docs/api-response-format.md @@ -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": { diff --git a/server/AyaNova/ControllerHelpers/ApiCreatedResponse.cs b/server/AyaNova/ControllerHelpers/ApiCreatedResponse.cs index cc4ccb30..03a90b13 100644 --- a/server/AyaNova/ControllerHelpers/ApiCreatedResponse.cs +++ b/server/AyaNova/ControllerHelpers/ApiCreatedResponse.cs @@ -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 diff --git a/server/AyaNova/ControllerHelpers/ApiOkResponse.cs b/server/AyaNova/ControllerHelpers/ApiOkResponse.cs index ac1f02a2..e535ef76 100644 --- a/server/AyaNova/ControllerHelpers/ApiOkResponse.cs +++ b/server/AyaNova/ControllerHelpers/ApiOkResponse.cs @@ -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 diff --git a/server/AyaNova/ControllerHelpers/ApiOkWithPagingResponse.cs b/server/AyaNova/ControllerHelpers/ApiOkWithPagingResponse.cs index b46c1d13..3d9b9247 100644 --- a/server/AyaNova/ControllerHelpers/ApiOkWithPagingResponse.cs +++ b/server/AyaNova/ControllerHelpers/ApiOkWithPagingResponse.cs @@ -8,22 +8,15 @@ namespace AyaNova.Api.ControllerHelpers public class ApiOkWithPagingResponse { - public object Result { get; } + public object Data { get; } public object Paging { get; } public ApiOkWithPagingResponse(ApiPagedResponse pr) { - Result = pr.items; + Data = pr.items; Paging = pr.PageLinks; - } - - // public ApiOkWithPagingResponse(object result, AyaNova.Models.PaginationLinkBuilder lb) - // { - // Result = result; - // Paging = lb.PagingData(); - - // } + } }//eoc diff --git a/server/AyaNova/Controllers/ApiRootController.cs b/server/AyaNova/Controllers/ApiRootController.cs index 3316ff1c..0ec5c834 100644 --- a/server/AyaNova/Controllers/ApiRootController.cs +++ b/server/AyaNova/Controllers/ApiRootController.cs @@ -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 /// @@ -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 diff --git a/test/raven-integration/Attachments/AttachmentTest.cs b/test/raven-integration/Attachments/AttachmentTest.cs index bfed5f4a..bc77b88d 100644 --- a/test/raven-integration/Attachments/AttachmentTest.cs +++ b/test/raven-integration/Attachments/AttachmentTest.cs @@ -48,8 +48,8 @@ namespace raven_integration Util.ValidateDataReturnResponseOk(a); - long lTestPngAttachmentId = a.ObjectResponse["result"][0]["id"].Value(); - long lTestZipAttachmentId = a.ObjectResponse["result"][1]["id"].Value(); + long lTestPngAttachmentId = a.ObjectResponse["data"][0]["id"].Value(); + long lTestZipAttachmentId = a.ObjectResponse["data"][1]["id"].Value(); //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 downloadToken = a.ObjectResponse["data"]["dlkey"].Value(); //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")); diff --git a/test/raven-integration/AyaType/AyaType.cs b/test/raven-integration/AyaType/AyaType.cs index 728e55e6..2dcac422 100644 --- a/test/raven-integration/AyaType/AyaType.cs +++ b/test/raven-integration/AyaType/AyaType.cs @@ -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().Should().Be(2); - a.ObjectResponse["result"][2]["name"].Value().Should().Be("Widget [Attachable] [Taggable]"); + a.ObjectResponse["data"][2]["id"].Value().Should().Be(2); + a.ObjectResponse["data"][2]["name"].Value().Should().Be("Widget [Attachable] [Taggable]"); } diff --git a/test/raven-integration/EventLog/EventLog.cs b/test/raven-integration/EventLog/EventLog.cs index 75c501c9..859197c4 100644 --- a/test/raven-integration/EventLog/EventLog.cs +++ b/test/raven-integration/EventLog/EventLog.cs @@ -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 w2Id = r2.ObjectResponse["data"]["id"].Value(); 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().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().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().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().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 CurrentUserId = EventLogResponse.ObjectResponse["data"][0]["userId"].Value(); //RETRIEVE //Get one ApiResponse r3 = await Util.GetAsync("Widget/" + w2Id.ToString(), await Util.GetTokenAsync("InventoryFull")); Util.ValidateDataReturnResponseOk(r3); - r3.ObjectResponse["result"]["name"].Value().Should().Be(w.name.ToString()); + r3.ObjectResponse["data"]["name"].Value().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().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().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().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().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(); + w.concurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); 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().Should().Be(w.name.ToString()); - uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value(); + checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(w.name.ToString()); + uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); 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().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().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().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().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().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().Should().Be(0);//AyEvent 0 = deleted - EventLogResponse.ObjectResponse["result"][0]["textra"].Value().Should().Be(w.name.ToString()); + ((JArray)EventLogResponse.ObjectResponse["data"]).Count.Should().Be(1); + EventLogResponse.ObjectResponse["data"][0]["date"].Value().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().Should().Be(0);//AyEvent 0 = deleted + EventLogResponse.ObjectResponse["data"][0]["textra"].Value().Should().Be(w.name.ToString()); } diff --git a/test/raven-integration/ImportV7/ImportV7.cs b/test/raven-integration/ImportV7/ImportV7.cs index b9661824..ee186744 100644 --- a/test/raven-integration/ImportV7/ImportV7.cs +++ b/test/raven-integration/ImportV7/ImportV7.cs @@ -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 importFileName = a.ObjectResponse["data"][0].Value(); importFileName.Should().Be(UploadFileName); diff --git a/test/raven-integration/JobOperations/JobOperations.cs b/test/raven-integration/JobOperations/JobOperations.cs index c3af2e4e..42bda167 100644 --- a/test/raven-integration/JobOperations/JobOperations.cs +++ b/test/raven-integration/JobOperations/JobOperations.cs @@ -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()==jobId) bFound=true; diff --git a/test/raven-integration/Locale/Locale.cs b/test/raven-integration/Locale/Locale.cs index 200d0ef8..639e0236 100644 --- a/test/raven-integration/Locale/Locale.cs +++ b/test/raven-integration/Locale/Locale.cs @@ -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().Should().Be(d.name.ToString()); - a.ObjectResponse["result"]["stock"].Value().Should().Be(false); - a.ObjectResponse["result"]["id"].Value().Should().BeGreaterThan(4); - a.ObjectResponse["result"]["concurrencyToken"].Value().Should().BeGreaterThan(0); - ((JArray)a.ObjectResponse["result"]["localeItems"]).Count.Should().BeGreaterThan(0); + a.ObjectResponse["data"]["name"].Value().Should().Be(d.name.ToString()); + a.ObjectResponse["data"]["stock"].Value().Should().Be(false); + a.ObjectResponse["data"]["id"].Value().Should().BeGreaterThan(4); + a.ObjectResponse["data"]["concurrencyToken"].Value().Should().BeGreaterThan(0); + ((JArray)a.ObjectResponse["data"]["localeItems"]).Count.Should().BeGreaterThan(0); - long NewId = a.ObjectResponse["result"]["id"].Value(); + long NewId = a.ObjectResponse["data"]["id"].Value(); //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(); + d2.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); 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().Should().Be(d2.newText.ToString()); - //uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value(); + checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(d2.newText.ToString()); + //uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); //Update locale key - var FirstLocaleKey = ((JArray)a.ObjectResponse["result"]["localeItems"])[0]; + var FirstLocaleKey = ((JArray)a.ObjectResponse["data"]["localeItems"])[0]; long UpdatedLocaleKeyId = FirstLocaleKey["id"].Value(); 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().Should().Be(d2.newText.ToString()); diff --git a/test/raven-integration/Locale/RequestedLocaleKeys.cs b/test/raven-integration/Locale/RequestedLocaleKeys.cs index 4d329f52..74a8d242 100644 --- a/test/raven-integration/Locale/RequestedLocaleKeys.cs +++ b/test/raven-integration/Locale/RequestedLocaleKeys.cs @@ -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(); + var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); 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(); + var RequestedKeyCount = a.ObjectResponse["data"]["requestedKeyCount"].Value(); RequestedKeyCount.Should().BeGreaterOrEqualTo(2); - var NotRequestedKeyCount = a.ObjectResponse["result"]["notRequestedKeyCount"].Value(); + var NotRequestedKeyCount = a.ObjectResponse["data"]["notRequestedKeyCount"].Value(); 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); } } diff --git a/test/raven-integration/Metrics/Metrics.cs b/test/raven-integration/Metrics/Metrics.cs index b3c4dd6c..712f2ba0 100644 --- a/test/raven-integration/Metrics/Metrics.cs +++ b/test/raven-integration/Metrics/Metrics.cs @@ -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); diff --git a/test/raven-integration/Search/SearchOps.cs b/test/raven-integration/Search/SearchOps.cs index e4e89013..46a23726 100644 --- a/test/raven-integration/Search/SearchOps.cs +++ b/test/raven-integration/Search/SearchOps.cs @@ -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 MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 MatchWidgetInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchNothingWidgetId = a.ObjectResponse["data"]["id"].Value(); //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 MatchingIdList = new List(); 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().Should().Be(2); + a.ObjectResponse["data"]["searchResults"][0]["type"].Value().Should().Be(2); //final item must be a user - a.ObjectResponse["result"]["searchResults"][MatchingIdList.Count - 1]["type"].Value().Should().Be(3); + a.ObjectResponse["data"]["searchResults"][MatchingIdList.Count - 1]["type"].Value().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(); - v = ((JArray)a.ObjectResponse["result"]["searchResults"]); + v = ((JArray)a.ObjectResponse["data"]["searchResults"]); foreach (JObject j in v) { MatchingIdList.Add(j["id"].Value()); @@ -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 MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchingIdList = new List(); 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 MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchingIdList = new List(); 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 MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchingIdList = new List(); 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 TagId = a.ObjectResponse["data"]["id"].Value(); //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 MatchWidgetInNotesId = a.ObjectResponse["data"]["id"].Value(); //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 NoPhraseMatchWidgetInTagId = a.ObjectResponse["data"]["id"].Value(); //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 MatchUserInNameId = a.ObjectResponse["data"]["id"].Value(); //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 MatchingIdList = new List(); 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(); + var TotalResultsFound = a.ObjectResponse["data"]["totalResultsFound"].Value(); //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(); - var MatchWidgetSerial = a.ObjectResponse["result"]["serial"].Value(); + long MatchWidgetInSerialId = a.ObjectResponse["data"]["id"].Value(); + var MatchWidgetSerial = a.ObjectResponse["data"]["serial"].Value(); //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 MatchingIdList = new List(); foreach (JObject j in v) { diff --git a/test/raven-integration/Tags/TagCrud.cs b/test/raven-integration/Tags/TagCrud.cs index 9b4b6e06..b53ec074 100644 --- a/test/raven-integration/Tags/TagCrud.cs +++ b/test/raven-integration/Tags/TagCrud.cs @@ -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(); - string tagName = a.ObjectResponse["result"]["name"].Value(); + long tagId = a.ObjectResponse["data"]["id"].Value(); + string tagName = a.ObjectResponse["data"]["name"].Value(); 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().Should().StartWith("testtag"); + a.ObjectResponse["data"]["name"].Value().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(); + w1.concurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); 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().Should().Be(w1.name.ToString().ToLowerInvariant().Replace(" ", "-")); - uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value(); + checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(w1.name.ToString().ToLowerInvariant().Replace(" ", "-")); + uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); //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().Should().Be(newName.ToLowerInvariant().Replace(" ", "-")); + checkPATCHWorked.ObjectResponse["data"]["name"].Value().Should().Be(newName.ToLowerInvariant().Replace(" ", "-")); // //DELETE ApiResponse DELETETestResponse = await Util.DeleteAsync("Tag/" + tagId.ToString(), await Util.GetTokenAsync("BizAdminFull")); diff --git a/test/raven-integration/Tags/TagGroupOps.cs b/test/raven-integration/Tags/TagGroupOps.cs index f5900eb7..d29ddf40 100644 --- a/test/raven-integration/Tags/TagGroupOps.cs +++ b/test/raven-integration/Tags/TagGroupOps.cs @@ -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 TestTag1Id = R.ObjectResponse["data"]["id"].Value(); //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 TestTag2Id = R.ObjectResponse["data"]["id"].Value(); //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 TestTagGroupId = R.ObjectResponse["data"]["id"].Value(); //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 WidgetId = R.ObjectResponse["data"]["id"].Value(); @@ -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 diff --git a/test/raven-integration/Tags/TagLists.cs b/test/raven-integration/Tags/TagLists.cs index db770878..db893f22 100644 --- a/test/raven-integration/Tags/TagLists.cs +++ b/test/raven-integration/Tags/TagLists.cs @@ -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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); //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) diff --git a/test/raven-integration/Tags/TagMapOps.cs b/test/raven-integration/Tags/TagMapOps.cs index afa191ee..c02c0806 100644 --- a/test/raven-integration/Tags/TagMapOps.cs +++ b/test/raven-integration/Tags/TagMapOps.cs @@ -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 tagId = a.ObjectResponse["data"]["id"].Value(); //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 widgetId = a.ObjectResponse["data"]["id"].Value(); //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 tagMapId = a.ObjectResponse["data"]["id"].Value(); //VERIFY TAGMAP a = await Util.GetAsync("TagMap/" + tagMapId.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateDataReturnResponseOk(a); - a.ObjectResponse["result"]["id"].Value().Should().Be(tagMapId); + a.ObjectResponse["data"]["id"].Value().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 tagId = a.ObjectResponse["data"]["id"].Value(); //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 widgetId = a.ObjectResponse["data"]["id"].Value(); //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 tagMapId = a.ObjectResponse["data"]["id"].Value(); //VERIFY TAGMAP a = await Util.GetAsync("TagMap/" + tagMapId.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateDataReturnResponseOk(a); - a.ObjectResponse["result"]["id"].Value().Should().Be(tagMapId); + a.ObjectResponse["data"]["id"].Value().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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); 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()); + createdTagList.Add(a.ObjectResponse["data"]["id"].Value()); //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 widgetId = a.ObjectResponse["data"]["id"].Value(); //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 TestTagId = R.ObjectResponse["data"]["id"].Value(); //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 Widget1Id = R.ObjectResponse["data"]["id"].Value(); //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 Widget2Id = R.ObjectResponse["data"]["id"].Value(); //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 TagMap1Id = R.ObjectResponse["data"]["id"].Value(); //VERIFY TAGMAP R = await Util.GetAsync("TagMap/" + TagMap1Id.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateDataReturnResponseOk(R); - R.ObjectResponse["result"]["id"].Value().Should().Be(TagMap1Id); - R.ObjectResponse["result"]["tagToObjectId"].Value().Should().Be(Widget1Id); + R.ObjectResponse["data"]["id"].Value().Should().Be(TagMap1Id); + R.ObjectResponse["data"]["tagToObjectId"].Value().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 TagMap2Id = R.ObjectResponse["data"]["id"].Value(); //VERIFY TAGMAP R = await Util.GetAsync("TagMap/" + TagMap2Id.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateDataReturnResponseOk(R); - R.ObjectResponse["result"]["id"].Value().Should().Be(TagMap2Id); - R.ObjectResponse["result"]["tagToObjectId"].Value().Should().Be(Widget2Id); + R.ObjectResponse["data"]["id"].Value().Should().Be(TagMap2Id); + R.ObjectResponse["data"]["tagToObjectId"].Value().Should().Be(Widget2Id); //UNTAG-ALL R = await Util.PostAsync("Tag/UntagAll/" + TestTagId.ToString(), await Util.GetTokenAsync("BizAdminFull")); diff --git a/test/raven-integration/User/UserCrud.cs b/test/raven-integration/User/UserCrud.cs index c60d5b52..274231e8 100644 --- a/test/raven-integration/User/UserCrud.cs +++ b/test/raven-integration/User/UserCrud.cs @@ -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 d1Id = R1.ObjectResponse["data"]["id"].Value(); 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 d2Id = R2.ObjectResponse["data"]["id"].Value(); //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().Should().Be(D2.name.ToString()); + R3.ObjectResponse["data"]["name"].Value().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(); + D2.concurrencyToken = R2.ObjectResponse["data"]["concurrencyToken"].Value(); 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().Should().Be(D2.name.ToString()); - uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value(); + checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(D2.name.ToString()); + uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); //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().Should().Be(newName); + checkPATCHWorked.ObjectResponse["data"]["name"].Value().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(); - uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + long D1Id = R.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + long w2Id = R.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + long w2Id = R.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + long UserId = R.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + long UserId = R.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //Test can login dynamic DCreds = new JObject(); diff --git a/test/raven-integration/User/UserOptionsRu.cs b/test/raven-integration/User/UserOptionsRu.cs index c38b66aa..841963e7 100644 --- a/test/raven-integration/User/UserOptionsRu.cs +++ b/test/raven-integration/User/UserOptionsRu.cs @@ -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 UserId = R.ObjectResponse["data"]["id"].Value(); //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().Should().Be(0); - uint concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + R.ObjectResponse["data"]["uiColor"].Value().Should().Be(0); + uint concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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().Should().Be(D2.emailaddress.ToString()); - R.ObjectResponse["result"]["timeZoneOffset"].Value().Should().Be((decimal)D2.TimeZoneOffset); - R.ObjectResponse["result"]["uiColor"].Value().Should().Be((int)D2.UiColor); - concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + R.ObjectResponse["data"]["emailAddress"].Value().Should().Be(D2.emailaddress.ToString()); + R.ObjectResponse["data"]["timeZoneOffset"].Value().Should().Be((decimal)D2.TimeZoneOffset); + R.ObjectResponse["data"]["uiColor"].Value().Should().Be((int)D2.UiColor); + concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //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().Should().Be(newEmail); - R.ObjectResponse["result"]["timeZoneOffset"].Value().Should().Be((decimal)D2.TimeZoneOffset); - R.ObjectResponse["result"]["uiColor"].Value().Should().Be((int)D2.UiColor); - // concurrencyToken = R.ObjectResponse["result"]["concurrencyToken"].Value(); + R.ObjectResponse["data"]["emailAddress"].Value().Should().Be(newEmail); + R.ObjectResponse["data"]["timeZoneOffset"].Value().Should().Be((decimal)D2.TimeZoneOffset); + R.ObjectResponse["data"]["uiColor"].Value().Should().Be((int)D2.UiColor); + // concurrencyToken = R.ObjectResponse["data"]["concurrencyToken"].Value(); //DELETE USER ApiResponse DELETETestResponse = await Util.DeleteAsync("User/" + UserId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in")); diff --git a/test/raven-integration/Widget/WidgetCrud.cs b/test/raven-integration/Widget/WidgetCrud.cs index 3f3ecc70..6855c4b9 100644 --- a/test/raven-integration/Widget/WidgetCrud.cs +++ b/test/raven-integration/Widget/WidgetCrud.cs @@ -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 w1Id = r1.ObjectResponse["data"]["id"].Value(); 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 w2Id = r2.ObjectResponse["data"]["id"].Value(); //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().Should().Be(w2.name.ToString()); - r3.ObjectResponse["result"]["notes"].Value().Should().Be(w2.notes.ToString()); + r3.ObjectResponse["data"]["name"].Value().Should().Be(w2.name.ToString()); + r3.ObjectResponse["data"]["notes"].Value().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(); + w2.concurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); 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().Should().Be(w2.name.ToString()); - uint concurrencyToken = PUTTestResponse.ObjectResponse["result"]["concurrencyToken"].Value(); + checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(w2.name.ToString()); + uint concurrencyToken = PUTTestResponse.ObjectResponse["data"]["concurrencyToken"].Value(); //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().Should().Be(newName); + checkPATCHWorked.ObjectResponse["data"]["name"].Value().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(); - uint OriginalConcurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value(); + long w2Id = r2.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); @@ -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(); - uint OriginalConcurrencyToken = r2.ObjectResponse["result"]["concurrencyToken"].Value(); + long w2Id = r2.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = r2.ObjectResponse["data"]["concurrencyToken"].Value(); //PATCH diff --git a/test/raven-integration/Widget/WidgetLists.cs b/test/raven-integration/Widget/WidgetLists.cs index 49fa6f3b..6d3c3b7f 100644 --- a/test/raven-integration/Widget/WidgetLists.cs +++ b/test/raven-integration/Widget/WidgetLists.cs @@ -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().Should().BeGreaterThan(5); diff --git a/test/raven-integration/Widget/WidgetRights.cs b/test/raven-integration/Widget/WidgetRights.cs index b6778a8e..52794c2c 100644 --- a/test/raven-integration/Widget/WidgetRights.cs +++ b/test/raven-integration/Widget/WidgetRights.cs @@ -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(); - uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value(); + long Id = a.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value(); + long Id = a.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); //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(); - uint OriginalConcurrencyToken = a.ObjectResponse["result"]["concurrencyToken"].Value(); + long Id = a.ObjectResponse["data"]["id"].Value(); + uint OriginalConcurrencyToken = a.ObjectResponse["data"]["concurrencyToken"].Value(); //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 Id = a.ObjectResponse["data"]["id"].Value(); //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 Id = a.ObjectResponse["data"]["id"].Value(); //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 Id = a.ObjectResponse["data"]["id"].Value(); //Now attempt delete a = await Util.DeleteAsync("Widget/" + Id.ToString(), await Util.GetTokenAsync( "TechFull")); diff --git a/test/raven-integration/Widget/WidgetValidationTests.cs b/test/raven-integration/Widget/WidgetValidationTests.cs index ef8e9b40..d9bf5703 100644 --- a/test/raven-integration/Widget/WidgetValidationTests.cs +++ b/test/raven-integration/Widget/WidgetValidationTests.cs @@ -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 Id = a.ObjectResponse["data"]["id"].Value(); //Now put a change with no ownerId set d.active = false; diff --git a/test/raven-integration/util.cs b/test/raven-integration/util.cs index 494c8f08..5f1a3eeb 100644 --- a/test/raven-integration/util.cs +++ b/test/raven-integration/util.cs @@ -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(); + authDict[login] = a.ObjectResponse["data"]["token"].Value(); } 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)