From e08f352b7a85ccf323a36c2a621f57253c4c4c32 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 13 May 2020 23:28:14 +0000 Subject: [PATCH] --- Authentication/Auth.cs | 12 ++--- ServerState/ServerStateTest.cs | 62 ++----------------------- Tags/TagOps.cs | 8 ++-- Translation/RequestedTranslationKeys.cs | 4 +- Translation/Translation.cs | 18 +++---- 5 files changed, 25 insertions(+), 79 deletions(-) diff --git a/Authentication/Auth.cs b/Authentication/Auth.cs index 00d69f0..5fecc78 100644 --- a/Authentication/Auth.cs +++ b/Authentication/Auth.cs @@ -45,7 +45,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "EXPIRED"));//lowest level test user because there are no limits on this route except to be authenticated Util.ValidateHTTPStatusCode(a, 401); } } @@ -60,7 +60,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_ISSUER"));//lowest level test user because there are no limits on this route except to be authenticated + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_ISSUER"));//lowest level test user because there are no limits on this route except to be authenticated Util.ValidateHTTPStatusCode(a, 401); } } @@ -75,7 +75,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM")); + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "NO_ALGORITHM")); Util.ValidateHTTPStatusCode(a, 401); } } @@ -90,7 +90,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET")); + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "WRONG_SECRET")); Util.ValidateHTTPStatusCode(a, 401); } } @@ -106,7 +106,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE")); + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRUNCATED_SIGNATURE")); Util.ValidateHTTPStatusCode(a, 401); } } @@ -122,7 +122,7 @@ namespace raven_integration var BuildMode = a.ObjectResponse["data"]["buildMode"].Value(); if (BuildMode == "DEBUG") { - a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE")); + a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("INTEGRATION_TEST", "TRANSPOSE_SIGNATURE")); Util.ValidateHTTPStatusCode(a, 401); } } diff --git a/ServerState/ServerStateTest.cs b/ServerState/ServerStateTest.cs index 6344d6c..23309fe 100644 --- a/ServerState/ServerStateTest.cs +++ b/ServerState/ServerStateTest.cs @@ -2,76 +2,22 @@ using Xunit; namespace raven_integration { - - public class ServerStateTest + + public class ServerStateTest { - - // ApiFixture fixture; - - // public ServerStateTest(ApiFixture _fixture) - // { - // this.fixture = _fixture; - // } - - - /// /// Test get state /// [Fact] public async void ServerStateShouldReturnOk() { - ApiResponse a = await Util.GetAsync("ServerState"); + ApiResponse a = await Util.GetAsync("server-state"); Util.ValidateDataReturnResponseOk(a); } - - - //can't test this because it fucks up other tests and the fixture - - // /// - // /// Test set state - // /// - // [Fact] - // public async void ServerStateShouldSet() - // { - - // /*{ - // "serverState": "open" - // } */ - - - // //open - // dynamic dd = new JObject(); - // dd.serverState = "open"; - - // ApiResponse aa = await Util.PostAsync("ServerState", fixture.ManagerAuthToken, dd.ToString()); - // Util.ValidateHTTPStatusCode(aa, 204); - - // //close - // dynamic d = new JObject(); - // d.serverState = "closed"; - - // ApiResponse a = await Util.PostAsync("ServerState", fixture.ManagerAuthToken, d.ToString()); - // Util.ValidateHTTPStatusCode(a, 204); - - // //open - // dynamic ddd = new JObject(); - // dd.serverState = "open"; - - // ApiResponse aaa = await Util.PostAsync("ServerState", fixture.ManagerAuthToken, ddd.ToString()); - // Util.ValidateHTTPStatusCode(aaa, 204); - - - - // } - - - - - + //NOTE: can't test set because it would break the other tests //================================================== diff --git a/Tags/TagOps.cs b/Tags/TagOps.cs index 2985688..4f50fb2 100644 --- a/Tags/TagOps.cs +++ b/Tags/TagOps.cs @@ -69,7 +69,7 @@ namespace raven_integration w = a.ObjectResponse["data"]; //validate the repository LIST ROUTE of tags contains the ones above - a = await Util.GetAsync($"TagList/list?query={TagNameStart}", await Util.GetTokenAsync("manager", "l3tm3in")); + a = await Util.GetAsync($"tag-list/list?query={TagNameStart}", await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); ((JArray)a.ObjectResponse["data"]).Count.Should().Be(7); @@ -91,13 +91,13 @@ namespace raven_integration //Verify the tags collection remaining - a = await Util.GetAsync($"TagList/list?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); + a = await Util.GetAsync($"tag-list/list?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); ((JArray)a.ObjectResponse["data"]).Count.Should().Be(9); //Verify the CLOUD LIST AND REF COUNT of tags collection remaining - a = await Util.GetAsync($"TagList/cloudlist?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); + a = await Util.GetAsync($"tag-list/cloudlist?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); ((JArray)a.ObjectResponse["data"]).Count.Should().Be(9); @@ -108,7 +108,7 @@ namespace raven_integration Util.ValidateHTTPStatusCode(DELETETestResponse, 204); //Verify the tags collection remaining - a = await Util.GetAsync($"TagList/list?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); + a = await Util.GetAsync($"tag-list/list?query=" + TagNameStart, await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); ((JArray)a.ObjectResponse["data"]).Count.Should().Be(0); diff --git a/Translation/RequestedTranslationKeys.cs b/Translation/RequestedTranslationKeys.cs index 0d3a105..cbc4628 100644 --- a/Translation/RequestedTranslationKeys.cs +++ b/Translation/RequestedTranslationKeys.cs @@ -34,14 +34,14 @@ namespace raven_integration d = JToken.FromObject(keys); //Fetch the values to force RAVEN to track at least these two - a = await Util.PostAsync("Translation/subset", await Util.GetTokenAsync("CustomerLimited"), d.ToString()); + a = await Util.PostAsync("translation/subset", await Util.GetTokenAsync("CustomerLimited"), 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["data"]).Count.Should().Be(2); //Now ensure there are at least two keys in the fetched keys array - a = await Util.GetAsync("Translation/TranslationKeyCoverage", await Util.GetTokenAsync("CustomerLimited")); + a = await Util.GetAsync("translation/TranslationKeyCoverage", await Util.GetTokenAsync("CustomerLimited")); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); diff --git a/Translation/Translation.cs b/Translation/Translation.cs index f07e6ff..e002edf 100644 --- a/Translation/Translation.cs +++ b/Translation/Translation.cs @@ -23,7 +23,7 @@ namespace raven_integration public async void TranslationListWorks() { //Get all - ApiResponse a = await Util.GetAsync("Translation/list", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated + ApiResponse a = await Util.GetAsync("translation/list", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 200); //there should be at least 4 of them as there are 4 stock translations @@ -35,7 +35,7 @@ namespace raven_integration public async void GetFullTranslationWorks() { //Get all - ApiResponse a = await Util.GetAsync("Translation/1", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated + ApiResponse a = await Util.GetAsync("translation/1", await Util.GetTokenAsync("CustomerLimited"));//lowest level test user because there are no limits on this route except to be authenticated 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 @@ -54,7 +54,7 @@ namespace raven_integration d = JToken.FromObject(keys); - ApiResponse a = await Util.PostAsync("Translation/subset", await Util.GetTokenAsync("CustomerLimited"), d.ToString()); + ApiResponse a = await Util.PostAsync("translation/subset", await Util.GetTokenAsync("CustomerLimited"), 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 @@ -71,7 +71,7 @@ namespace raven_integration d.id = 1; d.name = Util.Uniquify("INTEGRATION-TEST-LOCALE"); - ApiResponse a = await Util.PostAsync("Translation/Duplicate", await Util.GetTokenAsync("BizAdminFull"), d.ToString()); + ApiResponse a = await Util.PostAsync("translation/Duplicate", await Util.GetTokenAsync("BizAdminFull"), d.ToString()); Util.ValidateDataReturnResponseOk(a); Util.ValidateHTTPStatusCode(a, 201); //verify the object returned is as expected @@ -90,11 +90,11 @@ namespace raven_integration d2.id = NewId; d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALE NAME UPDATE"); d2.concurrency = a.ObjectResponse["data"]["concurrency"].Value(); - ApiResponse PUTTestResponse = await Util.PutAsync("Translation/UpdateTranslationName", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); + ApiResponse PUTTestResponse = await Util.PutAsync("translation/UpdateTranslationName", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); Util.ValidateHTTPStatusCode(PUTTestResponse, 200); - ApiResponse checkPUTWorked = await Util.GetAsync("Translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull")); + ApiResponse checkPUTWorked = await Util.GetAsync("translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateNoErrorInResponse(checkPUTWorked); checkPUTWorked.ObjectResponse["data"]["name"].Value().Should().Be(d2.newText.ToString()); //uint concurrency = PUTTestResponse.ObjectResponse["data"]["concurrency"].Value(); @@ -109,7 +109,7 @@ namespace raven_integration string UpdatedTranslationKey = FirstTranslationKey["key"].Value(); - PUTTestResponse = await Util.PutAsync("Translation/UpdateTranslationItemDisplayText", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); + PUTTestResponse = await Util.PutAsync("translation/UpdateTranslationItemDisplayText", await Util.GetTokenAsync("BizAdminFull"), d2.ToString()); Util.ValidateHTTPStatusCode(PUTTestResponse, 200); //create user that is set to new translation so can use getSubset @@ -161,7 +161,7 @@ namespace raven_integration d3 = JToken.FromObject(keys); - checkPUTWorked = await Util.PostAsync("Translation/subset", await Util.GetTokenAsync(Login, Password), d3.ToString()); + checkPUTWorked = await Util.PostAsync("translation/subset", await Util.GetTokenAsync(Login, Password), d3.ToString()); Util.ValidateDataReturnResponseOk(checkPUTWorked); Util.ValidateHTTPStatusCode(checkPUTWorked, 200); ((JArray)checkPUTWorked.ObjectResponse["data"]).Count.Should().Be(1); @@ -174,7 +174,7 @@ namespace raven_integration Util.ValidateHTTPStatusCode(a, 204); //DELETE TEMP LOCALE - a = await Util.DeleteAsync("Translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull")); + a = await Util.DeleteAsync("translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull")); Util.ValidateHTTPStatusCode(a, 204);