This commit is contained in:
2020-05-13 23:28:14 +00:00
parent 9716e67909
commit e08f352b7a
5 changed files with 25 additions and 79 deletions

View File

@@ -45,7 +45,7 @@ namespace raven_integration
var BuildMode = a.ObjectResponse["data"]["buildMode"].Value<string>();
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<string>();
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<string>();
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<string>();
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<string>();
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<string>();
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);
}
}

View File

@@ -2,76 +2,22 @@ using Xunit;
namespace raven_integration
{
public class ServerStateTest
public class ServerStateTest
{
// ApiFixture fixture;
// public ServerStateTest(ApiFixture _fixture)
// {
// this.fixture = _fixture;
// }
/// <summary>
/// Test get state
/// </summary>
[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
// /// <summary>
// /// Test set state
// /// </summary>
// [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
//==================================================

View File

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

View File

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

View File

@@ -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<uint>();
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<string>().Should().Be(d2.newText.ToString());
//uint concurrency = PUTTestResponse.ObjectResponse["data"]["concurrency"].Value<uint>();
@@ -109,7 +109,7 @@ namespace raven_integration
string UpdatedTranslationKey = FirstTranslationKey["key"].Value<string>();
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);