diff --git a/devdocs/todo.txt b/devdocs/todo.txt index c601cf19..61c66ed5 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -31,6 +31,8 @@ IMMEDIATE ITEMS: - Localized text - ** DEVISE a system to ensure no unused keys are brought forward to raven + --Finish test for requested key list route and ensure it's working + - Search and search text indexing - Add to widget tests - Auto visible id number assigning code diff --git a/server/AyaNova/Controllers/ApiRootController.cs b/server/AyaNova/Controllers/ApiRootController.cs index a5f4337a..d3a7cfe8 100644 --- a/server/AyaNova/Controllers/ApiRootController.cs +++ b/server/AyaNova/Controllers/ApiRootController.cs @@ -71,6 +71,35 @@ namespace AyaNova.Api.Controllers } +#if (DEBUG) + /// + /// Get build mode of server, used for automated testing purposes + /// + /// Required roles: Any + /// + /// + /// "DEBUG" or "RELEASE" + [HttpGet("BuildMode")] + public ActionResult BuildMode() + { + return Ok(new { result = new { BuildMode = "DEBUG" } }); + } +#else + /// + /// Get build mode of server, used for automated testing purposes + /// + /// Required roles: Any + /// + /// + /// "DEBUG" or "RELEASE" + [HttpGet("BuildMode")] + public ActionResult BuildMode() + { + return Ok(new { result = new { BuildMode = "RELEASE" } }); + } +#endif + + } } \ No newline at end of file diff --git a/test/raven-integration/Locale/RequestedKeys.cs b/test/raven-integration/Locale/RequestedKeys.cs new file mode 100644 index 00000000..d1c23b8d --- /dev/null +++ b/test/raven-integration/Locale/RequestedKeys.cs @@ -0,0 +1,60 @@ +using System; +using Xunit; +using Newtonsoft.Json.Linq; +using FluentAssertions; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Collections.Concurrent; +namespace raven_integration +{ + + public class RequestedKeys + { + + + + [Fact] + public async void RequestedKeysWorks() + { + //First determine if there is a requested key route because it's debug build dependent + //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(); + BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" })); + + if (BuildMode == "DEBUG") + { + + //Make a "list" of keys to fetch the values for + List keys = new List(); + keys.AddRange(new string[] { "HelpLicense", "ClientName" }); + dynamic d = new JObject(); + d.localeId = 1; + d.keys = JToken.FromObject(keys); + + //Fetch the values to force RAVEN to track at least these two + a = await Util.PostAsync("Locale/subset", await Util.GetTokenAsync("ClientLimited"), d.ToString()); + 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); + + //Now ensure there are at least two keys in the fetched keys array + a = await Util.PostAsync("Locale/RequestedKeyList", await Util.GetTokenAsync("ClientLimited"), d.ToString()); + 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); + + } + } + + + + + + //================================================== + + }//eoc +}//eons