This commit is contained in:
2020-04-09 19:26:00 +00:00
parent e1c13b7f8e
commit 6dd2f88276

View File

@@ -132,35 +132,14 @@ namespace raven_integration
//even though the record exists
//Just re-run the above search exactly but with a no rights to full User or Widget role instead
//Only BizAdmin* roles can read a full user record but anyone should be able to see names
//Only BizAdmin* roles can read a full user record
//This search should return zero items
a = await Util.PostAsync("Search", await Util.GetTokenAsync("SubContractorLimited"), 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");
//NAME ONLY SEARCH SHOULD WORK WITH NO RIGHTS TO READ FULL RECORD
//repeat same search but with nameOnly = true and should return at two records at least but not any of the body ones
SearchParameters = new JObject();
SearchParameters.phrase = TEST_SEARCH_PHRASE;
SearchParameters.nameOnly = true;
SearchParameters.typeOnly = 0;//no type
SearchParameters.maxResults = 0;
a = await Util.PostAsync("Search", await Util.GetTokenAsync("SubContractorLimited"), SearchParameters.ToString());
Util.ValidateDataReturnResponseOk(a);
((JArray)a.ObjectResponse["data"]["searchResults"]).Count.Should().BeGreaterOrEqualTo(2);
//Check that list does *not* include the notes only records
MatchingIdList = new List<long>();
v = ((JArray)a.ObjectResponse["data"]["searchResults"]);
foreach (JObject j in v)
{
MatchingIdList.Add(j["id"].Value<long>());
}
MatchingIdList.Should().NotContain(MatchWidgetInNotesId, "ShouldNotContainMatchWidgetInNotesId");
MatchingIdList.Should().Contain(MatchWidgetInNameId, "ShouldContainMatchWidgetInNameId");
MatchingIdList.Should().NotContain(MatchUserInNotesId, "ShouldContainMatchUserInNotesId");
MatchingIdList.Should().Contain(MatchUserInNameId, "ShouldContainMatchUserInNameId");
MatchingIdList.Should().NotContain(MatchNothingWidgetId, "ShouldNotContainThirdWidget");
}//eot
@@ -298,9 +277,9 @@ namespace raven_integration
[Fact]
public async void WildCardContainsSearchShouldWork()
public async void SearchAndExtractShouldWork()
{
const string TEST_SEARCH_PHRASE = "*cast* goose";
const string TEST_SEARCH_PHRASE = "cast goose";
//CREATE A WIDGET
dynamic D = new JObject();
@@ -358,6 +337,14 @@ namespace raven_integration
MatchingIdList.Should().Contain(MatchWidgetInNotesId, "ShouldContainMatchWidgetInNotesId");
MatchingIdList.Should().Contain(MatchUserInNameId, "ShouldContainMatchUserInNameId");
//Ensure excerpt works and contains the search phrase
// /Search/Info/2/1?phrase=we&max=200
a = await Util.GetAsync($"Search/Info/2/{MatchWidgetInNotesId}?phrase={TEST_SEARCH_PHRASE}&max=200", await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a);
a.ObjectResponse["data"].Value<string>().Should().Contain(TEST_SEARCH_PHRASE.Split(" ")[0]);
a.ObjectResponse["data"].Value<string>().Should().Contain(TEST_SEARCH_PHRASE.Split(" ")[1]);
}//eot
@@ -585,6 +572,7 @@ namespace raven_integration
MatchingIdList.Should().Contain(MatchWidgetInSerialId, "ShouldContainMatchWidgetInSerialId");
}//eot