4648
This commit is contained in:
@@ -7,12 +7,9 @@ namespace raven_integration
|
||||
|
||||
public class SearchOps
|
||||
{
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task PhraseOnlySearchShouldReturnCorrectResultsInOrder()
|
||||
{
|
||||
|
||||
//CREATE A PROJECT phrase in notes
|
||||
var projectName = Util.Uniquify("search notes test project should match");
|
||||
var dateStarted = DateTime.Now.ToString("o");
|
||||
@@ -29,7 +26,7 @@ namespace raven_integration
|
||||
payload = $$"""
|
||||
{"id":0,"concurrency":0,"active":true,"allowLogin":true,"name":"{{userName}}","roles":8,"userType":2,"employeeNumber":null,"notes":null,"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);
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
@@ -60,7 +57,6 @@ namespace raven_integration
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchNothingProjectId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//Now see if can find those objects with a phrase search
|
||||
dynamic SearchParameters = new JObject();
|
||||
SearchParameters.phrase = "simple dogs";
|
||||
@@ -87,20 +83,16 @@ namespace raven_integration
|
||||
MatchingIdList.Should().Contain(MatchUserInNameId, "ShouldContainMatchUserInNameId");
|
||||
MatchingIdList.Should().NotContain(MatchNothingProjectId, "ShouldNotContainMatchNothingProjectId");
|
||||
|
||||
//FULL BODY SEARCH RIGHTS
|
||||
//SEARCH RIGHTS
|
||||
//First up test a full record search returns no results due to insufficient rights
|
||||
//even though the record exists
|
||||
//Just re-run the above search exactly but with a no rights to full User or Project role instead
|
||||
|
||||
//Only BizAdmin* roles can read a full user record
|
||||
//This search should return zero items
|
||||
a = await Util.PostAsync("search", await Util.GetTokenAsync("SubContractorRestricted"), SearchParameters.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().Be(0, "User with no rights should not see any results in body search");
|
||||
|
||||
|
||||
|
||||
|
||||
}//eot
|
||||
|
||||
|
||||
@@ -111,33 +103,22 @@ namespace raven_integration
|
||||
const string TEST_SEARCH_PHRASE = "hap* goose";
|
||||
|
||||
//CREATE A PROJECT
|
||||
dynamic D = new JObject();
|
||||
D.name = Util.Uniquify("Wildcard startswith search test PROJECT");
|
||||
var projectName = Util.Uniquify("Wildcard startswith 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: The quick brown and hapless goose","wiki":null,"customFields":"{}","tags":["blue","zebra"],"dateStarted":"{{dateStarted}}","dateCompleted":null,"projectOverseerId":null,"accountNumber":"TestAccountNumber"}
|
||||
""";
|
||||
|
||||
D.dollarAmount = 1.11m;
|
||||
D.active = true;
|
||||
D.usertype = 1;
|
||||
D.notes = "This record will match in notes: The quick brown and hapless goose";
|
||||
|
||||
|
||||
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
||||
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchProjectInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
D.name = Util.Uniquify("Wildcard startswith search NAME happy goose Test User");
|
||||
D.notes = "This user has the match in it's name";
|
||||
|
||||
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());
|
||||
var userName = Util.Uniquify("Wildcard startswith search NAME happy goose Test User");
|
||||
payload = $$"""
|
||||
{"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);
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
@@ -176,32 +157,22 @@ namespace raven_integration
|
||||
const string TEST_SEARCH_PHRASE = "goose *act";
|
||||
|
||||
//CREATE A PROJECT
|
||||
dynamic D = new JObject();
|
||||
D.name = Util.Uniquify("Wildcard endswith search test PROJECT");
|
||||
var projectName = Util.Uniquify("Wildcard endswith 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: react to the goose","wiki":null,"customFields":"{}","tags":["blue","zebra"],"dateStarted":"{{dateStarted}}","dateCompleted":null,"projectOverseerId":null,"accountNumber":"TestAccountNumber"}
|
||||
""";
|
||||
|
||||
D.dollarAmount = 1.11m;
|
||||
D.active = true;
|
||||
D.usertype = 1;
|
||||
D.notes = "This record will match in notes: react to the goose";
|
||||
|
||||
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), D.ToString());
|
||||
ApiResponse a = await Util.PostAsync("project", await Util.GetTokenAsync("superuser", "l3tm3in"), payload);
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchProjectInNotesId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||
D = new JObject();
|
||||
D.name = Util.Uniquify("Wildcard endswith search NAME goose exact Test User");
|
||||
D.notes = "This user has the match in it's name";
|
||||
|
||||
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());
|
||||
var userName = Util.Uniquify("Wildcard endswith search NAME goose exact Test User");
|
||||
payload = $$"""
|
||||
{"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);
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long MatchUserInNameId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user