l.s.s.t.t.TestBingSearchService(TestCase) : class documentation

Part of lp.services.sitesearch.tests.test_bing View In Hierarchy

Test BingSearchService.
Method setUp Undocumented
Method test_configuration Undocumented
Method test_create_search_url Undocumented
Method test_create_search_url_escapes_unicode_chars Undocumented
Method test_create_search_url_with_offset Undocumented
Method test_create_search_url_empty_terms Undocumented
Method test_create_search_url_null_terms Undocumented
Method test_create_search_url_requires_start Undocumented
Method test_parse_search_response_invalid_total The PageMatches's total attribute comes from the
Method test_parse_search_response_negative_total If the total is ever less than zero (see bug 683115),
Method test_parse_search_response_missing_title A PageMatch requires a title, url, and a summary. If those elements
Method test_parse_search_response_missing_summary When a match is missing a summary ('snippet'), the match is skipped
Method test_parse_search_response_missing_url When the URL ('url') cannot be found the match is skipped. There are
Method test_parse_search_response_with_no_meaningful_results If no matches are found in the response, and there are 20 or fewer
Method test_search_converts_HTTPError Undocumented
Method test_search_converts_ConnectionError Undocumented
Method test_search_converts_TimeoutError Undocumented
Method test_parse_search_response_TypeError Undocumented
Method test_parse_search_response_ValueError Undocumented
Method test_parse_search_response_KeyError Undocumented
Method test_search_uses_proxy Undocumented
Method test_search_with_results Undocumented
Method test_search_with_results_and_offset Undocumented
Method test_search_no_results Undocumented
Method test_search_no_meaningful_results Undocumented
Method test_search_incomplete_response Undocumented
Method test_search_error_response Undocumented
Method test_search_xss Undocumented

Inherited from TestCase:

Method becomeDbUser Commit, then log into the database as dbuser.
Method __str__ The string representation of a test is its id.
Method useContext Use the supplied context in this test.
Method makeTemporaryDirectory Create a temporary directory, and return its path.
Method installKarmaRecorder Set up and return a KarmaRecorder.
Method assertProvides Assert 'obj' correctly provides 'interface'.
Method assertNotifies Assert that a callable performs a given notification.
Method assertNoNotification Assert that no notifications are generated by the callable.
Method assertSqlAttributeEqualsDate Fail unless the value of the attribute is equal to the date.
Method assertTextMatchesExpressionIgnoreWhitespace Undocumented
Method assertIsInstance Assert that an instance is an instance of assert_class.
Method assertIsNot Assert that expected is not the same object as observed.
Method assertContentEqual Assert that 'iter1' has the same content as 'iter2'.
Method assertRaisesWithContent Check if the given exception is raised with given content.
Method assertBetween Assert that 'variable' is strictly between two boundaries.
Method assertVectorEqual Apply assertEqual to all given pairs in one go.
Method expectedLog Expect a log to be written that matches the regex.
Method pushConfig Push some key-value pairs into a section of the config.
Method attachOopses Undocumented
Method attachLibrarianLog Include the logChunks from fixture in the test details.
Method assertStatementCount Assert that the expected number of SQL statements occurred.
Method useTempDir Use a temporary directory for this test.
Method assertEmailHeadersEqual Assert that two email headers are equal.
Method assertStartsWith Undocumented
Method assertEndsWith Asserts that s ends with suffix.
Method checkPermissions Check if the used_permissions match expected_permissions.
Method assertEmailQueueLength Pop the email queue, assert its length, and return it.
Method _unfoldEmailHeader Unfold a multiline email header.
def setUp(self):
Undocumented
def test_configuration(self):
Undocumented
def test_create_search_url(self):
Undocumented
def test_create_search_url_escapes_unicode_chars(self):
Undocumented
def test_create_search_url_with_offset(self):
Undocumented
def test_create_search_url_empty_terms(self):
Undocumented
def test_create_search_url_null_terms(self):
Undocumented
def test_create_search_url_requires_start(self):
Undocumented
def test_parse_search_response_invalid_total(self):
The PageMatches's total attribute comes from the webPages.totalEstimatedMatches JSON element. When it cannot be found and the value cast to an int, an error is raised. If Bing were to redefine the meaning of the element to use a '~' to indicate an approximate total, an error would be raised.
def test_parse_search_response_negative_total(self):
If the total is ever less than zero (see bug 683115), this is expected: we simply return a total of 0.
def test_parse_search_response_missing_title(self):
A PageMatch requires a title, url, and a summary. If those elements cannot be found, a PageMatch cannot be made. A missing title ('name') indicates a bad page on Launchpad, so it is ignored. In this example, the first match is missing a title, so only the second page is present in the PageMatches.
def test_parse_search_response_missing_summary(self):
When a match is missing a summary ('snippet'), the match is skipped because there is no information about why it matched. This appears to relate to pages that are in the index, but should be removed. In this example taken from real data, the links are to the same page on different vhosts. The edge vhost has no summary, so it is skipped.
def test_parse_search_response_missing_url(self):
When the URL ('url') cannot be found the match is skipped. There are no examples of this. We do not want this hypothetical situation to give users a bad experience.
def test_parse_search_response_with_no_meaningful_results(self):
If no matches are found in the response, and there are 20 or fewer results, an Empty PageMatches is returned. This happens when the results are missing titles and summaries. This is not considered to be a problem because the small number implies that Bing did a poor job of indexing pages or indexed the wrong Launchpad server. In this example, there is only one match, but the results is missing a title so there is not enough information to make a PageMatch.
@responses.activate
def test_search_converts_HTTPError(self):
Undocumented
@responses.activate
def test_search_converts_ConnectionError(self):
Undocumented
@responses.activate
def test_search_converts_TimeoutError(self):
Undocumented
def test_parse_search_response_TypeError(self):
Undocumented
def test_parse_search_response_ValueError(self):
Undocumented
def test_parse_search_response_KeyError(self):
Undocumented
def test_search_uses_proxy(self):
Undocumented
def test_search_with_results(self):
Undocumented
def test_search_with_results_and_offset(self):
Undocumented
def test_search_no_results(self):
Undocumented
def test_search_no_meaningful_results(self):
Undocumented
def test_search_incomplete_response(self):
Undocumented
def test_search_error_response(self):
Undocumented
def test_search_xss(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.