4648
This commit is contained in:
@@ -1,67 +1,67 @@
|
||||
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 RequestedLocaleKeys
|
||||
{
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public async void RequestedLocaleKeysWorks()
|
||||
{
|
||||
//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("build-mode", await Util.GetTokenAsync("CustomerLimited"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var BuildMode = a.ObjectResponse["data"]["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", "CustomerName" });
|
||||
dynamic d = new JObject();
|
||||
|
||||
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());
|
||||
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"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
var RequestedKeyCount = a.ObjectResponse["data"]["requestedKeyCount"].Value<int>();
|
||||
RequestedKeyCount.Should().BeGreaterOrEqualTo(2);
|
||||
var NotRequestedKeyCount = a.ObjectResponse["data"]["notRequestedKeyCount"].Value<int>();
|
||||
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["data"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
||||
((JArray)a.ObjectResponse["data"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
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 RequestedLocaleKeys
|
||||
{
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task RequestedLocaleKeysWorks()
|
||||
{
|
||||
//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("build-mode", await Util.GetTokenAsync("CustomerLimited"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
var BuildMode = a.ObjectResponse["data"]["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", "CustomerName" });
|
||||
dynamic d = new JObject();
|
||||
|
||||
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());
|
||||
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"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
var RequestedKeyCount = a.ObjectResponse["data"]["requestedKeyCount"].Value<int>();
|
||||
RequestedKeyCount.Should().BeGreaterOrEqualTo(2);
|
||||
var NotRequestedKeyCount = a.ObjectResponse["data"]["notRequestedKeyCount"].Value<int>();
|
||||
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["data"]["requestedKeys"]).Count.Should().Be(RequestedKeyCount);
|
||||
((JArray)a.ObjectResponse["data"]["notRequestedKeys"]).Count.Should().Be(NotRequestedKeyCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
|
||||
@@ -1,188 +1,188 @@
|
||||
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 Translation
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
ImportTranslation(ct, ResourceFolderPath, "en"); - id 1
|
||||
ImportTranslation(ct, ResourceFolderPath, "es"); - id 2
|
||||
ImportTranslation(ct, ResourceFolderPath, "fr"); - id 3
|
||||
ImportTranslation(ct, ResourceFolderPath, "de"); - id 4
|
||||
*/
|
||||
|
||||
[Fact]
|
||||
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
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 4 of them as there are 4 stock translations
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(3);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
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
|
||||
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"]["translationItems"]).Count.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async void GetSubsetWorks()
|
||||
{
|
||||
|
||||
|
||||
List<string> keys = new List<string>();
|
||||
keys.AddRange(new string[] { "AddressType", "CustomerName", "RateName", "WorkOrder" });
|
||||
dynamic d = new JObject();
|
||||
|
||||
d = JToken.FromObject(keys);
|
||||
|
||||
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
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(4);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async void DuplicateUpdateAndDeleteWorks()
|
||||
{
|
||||
|
||||
//DUPLICATE
|
||||
dynamic d = new JObject();
|
||||
d.id = 1;
|
||||
d.name = Util.Uniquify("INTEGRATION-TEST-LOCALE");
|
||||
|
||||
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
|
||||
a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
||||
a.ObjectResponse["data"]["stock"].Value<bool>().Should().Be(false);
|
||||
a.ObjectResponse["data"]["id"].Value<long>().Should().BeGreaterThan(4);
|
||||
a.ObjectResponse["data"]["concurrency"].Value<uint>().Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["data"]["translationItems"]).Count.Should().BeGreaterThan(0);
|
||||
|
||||
long NewId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//UPDATE
|
||||
//Update translation name
|
||||
|
||||
dynamic d2 = new JObject();
|
||||
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());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
|
||||
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>();
|
||||
|
||||
|
||||
//Update translation key
|
||||
var FirstTranslationKey = ((JArray)a.ObjectResponse["data"]["translationItems"])[0];
|
||||
long UpdatedTranslationKeyId = FirstTranslationKey["id"].Value<long>();
|
||||
d2.id = UpdatedTranslationKeyId;
|
||||
d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALEITEM DISPLAY UPDATE");
|
||||
d2.concurrency = FirstTranslationKey["concurrency"].Value<uint>();
|
||||
|
||||
string UpdatedTranslationKey = FirstTranslationKey["key"].Value<string>();
|
||||
|
||||
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
|
||||
var Login = Util.Uniquify("LOGIN");
|
||||
var Password = Util.Uniquify("PASSWORD");
|
||||
dynamic DUSER = new JObject();
|
||||
DUSER.name = Util.Uniquify("TranslationUpdateSubsetTestUser");
|
||||
|
||||
DUSER.active = true;
|
||||
DUSER.login = Login;
|
||||
DUSER.password = Password;
|
||||
DUSER.roles = 0;//norole (any role can get a subset of translation keys)
|
||||
// DUSER.translationId = NewId;
|
||||
DUSER.userType = 3;//non scheduleable
|
||||
//Required by form custom rules
|
||||
DUSER.notes = "notes";
|
||||
DUSER.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), DUSER.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long DUSERID = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//RETRIEVE companion USEROPTIONS object
|
||||
ApiResponse R = await Util.GetAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["data"]["uiColor"].Value<string>().Should().Be("#000000");
|
||||
uint concurrency = R.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
|
||||
//UPDATE
|
||||
|
||||
//PUT
|
||||
dynamic D2 = new JObject();
|
||||
D2.translationId = NewId;
|
||||
|
||||
D2.concurrency = concurrency;
|
||||
PUTTestResponse = await Util.PutAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//VALIDATE
|
||||
R = await Util.GetAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
|
||||
|
||||
List<string> keys = new List<string>();
|
||||
keys.AddRange(new string[] { UpdatedTranslationKey });
|
||||
dynamic d3 = new JObject();
|
||||
|
||||
d3 = JToken.FromObject(keys);
|
||||
|
||||
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);
|
||||
var FirstTranslationKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["data"])[0];
|
||||
|
||||
FirstTranslationKeyUpdated["value"].Value<string>().Should().Be(d2.newText.ToString());
|
||||
|
||||
//DELETE TEMPORARY USER SO CAN DELETE LOCALE
|
||||
a = await Util.DeleteAsync("User/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
//DELETE TEMP LOCALE
|
||||
a = await Util.DeleteAsync("translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
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 Translation
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
ImportTranslation(ct, ResourceFolderPath, "en"); - id 1
|
||||
ImportTranslation(ct, ResourceFolderPath, "es"); - id 2
|
||||
ImportTranslation(ct, ResourceFolderPath, "fr"); - id 3
|
||||
ImportTranslation(ct, ResourceFolderPath, "de"); - id 4
|
||||
*/
|
||||
|
||||
[Fact]
|
||||
public async Task 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
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
//there should be at least 4 of them as there are 4 stock translations
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(3);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task 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
|
||||
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"]["translationItems"]).Count.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task GetSubsetWorks()
|
||||
{
|
||||
|
||||
|
||||
List<string> keys = new List<string>();
|
||||
keys.AddRange(new string[] { "AddressType", "CustomerName", "RateName", "WorkOrder" });
|
||||
dynamic d = new JObject();
|
||||
|
||||
d = JToken.FromObject(keys);
|
||||
|
||||
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
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(4);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task DuplicateUpdateAndDeleteWorks()
|
||||
{
|
||||
|
||||
//DUPLICATE
|
||||
dynamic d = new JObject();
|
||||
d.id = 1;
|
||||
d.name = Util.Uniquify("INTEGRATION-TEST-LOCALE");
|
||||
|
||||
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
|
||||
a.ObjectResponse["data"]["name"].Value<string>().Should().Be(d.name.ToString());
|
||||
a.ObjectResponse["data"]["stock"].Value<bool>().Should().Be(false);
|
||||
a.ObjectResponse["data"]["id"].Value<long>().Should().BeGreaterThan(4);
|
||||
a.ObjectResponse["data"]["concurrency"].Value<uint>().Should().BeGreaterThan(0);
|
||||
((JArray)a.ObjectResponse["data"]["translationItems"]).Count.Should().BeGreaterThan(0);
|
||||
|
||||
long NewId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//UPDATE
|
||||
//Update translation name
|
||||
|
||||
dynamic d2 = new JObject();
|
||||
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());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
|
||||
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>();
|
||||
|
||||
|
||||
//Update translation key
|
||||
var FirstTranslationKey = ((JArray)a.ObjectResponse["data"]["translationItems"])[0];
|
||||
long UpdatedTranslationKeyId = FirstTranslationKey["id"].Value<long>();
|
||||
d2.id = UpdatedTranslationKeyId;
|
||||
d2.newText = Util.Uniquify("INTEGRATION-TEST-LOCALEITEM DISPLAY UPDATE");
|
||||
d2.concurrency = FirstTranslationKey["concurrency"].Value<uint>();
|
||||
|
||||
string UpdatedTranslationKey = FirstTranslationKey["key"].Value<string>();
|
||||
|
||||
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
|
||||
var Login = Util.Uniquify("LOGIN");
|
||||
var Password = Util.Uniquify("PASSWORD");
|
||||
dynamic DUSER = new JObject();
|
||||
DUSER.name = Util.Uniquify("TranslationUpdateSubsetTestUser");
|
||||
|
||||
DUSER.active = true;
|
||||
DUSER.login = Login;
|
||||
DUSER.password = Password;
|
||||
DUSER.roles = 0;//norole (any role can get a subset of translation keys)
|
||||
// DUSER.translationId = NewId;
|
||||
DUSER.userType = 3;//non scheduleable
|
||||
//Required by form custom rules
|
||||
DUSER.notes = "notes";
|
||||
DUSER.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), DUSER.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long DUSERID = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//RETRIEVE companion USEROPTIONS object
|
||||
ApiResponse R = await Util.GetAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
//ensure the default value is set
|
||||
R.ObjectResponse["data"]["uiColor"].Value<string>().Should().Be("#000000");
|
||||
uint concurrency = R.ObjectResponse["data"]["concurrency"].Value<uint>();
|
||||
|
||||
//UPDATE
|
||||
|
||||
//PUT
|
||||
dynamic D2 = new JObject();
|
||||
D2.translationId = NewId;
|
||||
|
||||
D2.concurrency = concurrency;
|
||||
PUTTestResponse = await Util.PutAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"), D2.ToString());
|
||||
Util.ValidateHTTPStatusCode(PUTTestResponse, 200);
|
||||
|
||||
//VALIDATE
|
||||
R = await Util.GetAsync("user-option/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(R);
|
||||
|
||||
|
||||
|
||||
List<string> keys = new List<string>();
|
||||
keys.AddRange(new string[] { UpdatedTranslationKey });
|
||||
dynamic d3 = new JObject();
|
||||
|
||||
d3 = JToken.FromObject(keys);
|
||||
|
||||
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);
|
||||
var FirstTranslationKeyUpdated = ((JArray)checkPUTWorked.ObjectResponse["data"])[0];
|
||||
|
||||
FirstTranslationKeyUpdated["value"].Value<string>().Should().Be(d2.newText.ToString());
|
||||
|
||||
//DELETE TEMPORARY USER SO CAN DELETE LOCALE
|
||||
a = await Util.DeleteAsync("User/" + DUSERID.ToString(), await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
//DELETE TEMP LOCALE
|
||||
a = await Util.DeleteAsync("translation/" + NewId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
|
||||
Reference in New Issue
Block a user