This commit is contained in:
2018-09-18 00:11:34 +00:00
parent 8c4319f094
commit 71cbeff6ba
3 changed files with 91 additions and 0 deletions

View File

@@ -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

View File

@@ -71,6 +71,35 @@ namespace AyaNova.Api.Controllers
}
#if (DEBUG)
/// <summary>
/// Get build mode of server, used for automated testing purposes
///
/// Required roles: Any
///
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("BuildMode")]
public ActionResult BuildMode()
{
return Ok(new { result = new { BuildMode = "DEBUG" } });
}
#else
/// <summary>
/// Get build mode of server, used for automated testing purposes
///
/// Required roles: Any
///
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("BuildMode")]
public ActionResult BuildMode()
{
return Ok(new { result = new { BuildMode = "RELEASE" } });
}
#endif
}
}

View File

@@ -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<string>();
BuildMode.Should().BeOneOf((new string[] { "DEBUG", "RELEASE" }));
if (BuildMode == "DEBUG")
{
//Make a "list" of keys to fetch the values for
List<string> keys = new List<string>();
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