4648
This commit is contained in:
@@ -210,35 +210,25 @@ namespace raven_integration
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task SearchAndExtractShouldWork()
|
public async Task SearchAndExtractShouldWork()
|
||||||
{
|
{
|
||||||
const string TEST_SEARCH_PHRASE = "cast goose";
|
const string TEST_SEARCH_PHRASE = "*cast* goose";
|
||||||
|
|
||||||
//CREATE A PROJECT
|
//CREATE A PROJECT
|
||||||
dynamic D = new JObject();
|
var projectName = Util.Uniquify("Wildcard contains search test PROJECT");
|
||||||
D.name = Util.Uniquify("Wildcard contains search test PROJECT");
|
var dateStarted = DateTime.Now.ToString("o");
|
||||||
|
var payload = $$"""
|
||||||
|
{"id":0,"concurrency":0,"name":"{{projectName}}","active":true,"notes":"This record will match in notes: broadcasting to the goose","wiki":null,"customFields":"{}","tags":["blue","zebra"],"dateStarted":"{{dateStarted}}","dateCompleted":null,"projectOverseerId":null,"accountNumber":"TestAccountNumber"}
|
||||||
|
""";
|
||||||
|
|
||||||
D.dollarAmount = 1.11m;
|
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
|
||||||
D.active = true;
|
|
||||||
D.usertype = 1;
|
|
||||||
D.notes = "This record will match in notes: broadcasting to the goose";
|
|
||||||
|
|
||||||
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long MatchProjectInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
long MatchProjectInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||||
D = new JObject();
|
var userName = Util.Uniquify("Wildcard contains search NAME goose elcastro Test User");
|
||||||
D.name = Util.Uniquify("Wildcard contains search NAME goose elcastro Test User");
|
payload = $$"""
|
||||||
D.notes = "This user has the match in it's name";
|
{"id":0,"concurrency":0,"active":true,"allowLogin":true,"name":"{{userName}}","roles":8,"userType":2,"employeeNumber":null,"notes":"This user has the match in it's name","customerId":null,"headOfficeId":null,"vendorId":null,"wiki":null,"customFields":"{}","tags":[],"lastLogin":null,"password":"{{userName}}","login":"{{userName}}"}
|
||||||
|
""";
|
||||||
|
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
|
||||||
|
|
||||||
D.active = true;
|
|
||||||
D.login = Util.Uniquify("LOGIN");
|
|
||||||
D.password = Util.Uniquify("PASSWORD");
|
|
||||||
D.usertype = 1;
|
|
||||||
|
|
||||||
D.userType = 2;// not service type user
|
|
||||||
D.customFields = Util.UserRequiredCustomFieldsJsonString();
|
|
||||||
|
|
||||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
@@ -258,7 +248,7 @@ namespace raven_integration
|
|||||||
|
|
||||||
//Turn the list into an array of id's
|
//Turn the list into an array of id's
|
||||||
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
var v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
|
||||||
List<long> MatchingIdList = new List<long>();
|
List<long> MatchingIdList = [];
|
||||||
foreach (JObject j in v)
|
foreach (JObject j in v)
|
||||||
{
|
{
|
||||||
MatchingIdList.Add(j["id"].Value<long>());
|
MatchingIdList.Add(j["id"].Value<long>());
|
||||||
@@ -271,10 +261,10 @@ namespace raven_integration
|
|||||||
|
|
||||||
//Ensure excerpt works and contains the search phrase
|
//Ensure excerpt works and contains the search phrase
|
||||||
// /Search/Info/2/1?phrase=we&max=200
|
// /Search/Info/2/1?phrase=we&max=200
|
||||||
a = await Util.GetAsync($"search/Info/2/{MatchProjectInNotesId}?phrase={TEST_SEARCH_PHRASE}&max=200", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
a = await Util.GetAsync($"search/Info/25/{MatchProjectInNotesId}?phrase={TEST_SEARCH_PHRASE}&max=200", await Util.GetTokenAsync("superuser", "l3tm3in"));
|
||||||
Util.ValidateDataReturnResponseOk(a);
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
a.ObjectResponse["data"].Value<string>().Should().Contain(TEST_SEARCH_PHRASE.Split(" ")[0]);
|
a.ObjectResponse["data"].Value<string>().Should().Contain("broadcasting to the goose");
|
||||||
a.ObjectResponse["data"].Value<string>().Should().Contain(TEST_SEARCH_PHRASE.Split(" ")[1]);
|
a.ObjectResponse["data"].Value<string>().Should().Contain("PROJECT");
|
||||||
|
|
||||||
}//eot
|
}//eot
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user