summary refs log tree commit diff
path: root/tests/test_preview.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix URL preview errors when previewing XML documents. (#11196)Patrick Cloke2021-10-271-0/+15
|
* Ensure each charset is attempted only once during media preview. (#11089)Patrick Cloke2021-10-141-8/+35
| | | | There's no point in trying more than once since it is guaranteed to continually fail.
* Attempt different character encodings when previewing a URL. (#11077)Patrick Cloke2021-10-141-26/+40
| | | | This follows similar logic to BeautifulSoup where we attempt different character encodings until we find one which works.
* Autodiscover oEmbed endpoint from returned HTML (#10822)Patrick Cloke2021-10-081-16/+24
| | | | | Searches the returned HTML for an oEmbed endpoint using the autodiscovery mechanism (`<link rel=...>`), and will request it to generate the preview.
* Support underscores (in addition to hyphens) for charset detection. (#10410)sri-vidyut2021-07-271-0/+13
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Handle additional errors when previewing URLs. (#9333)Patrick Cloke2021-02-081-11/+92
| | | | * Handle the case of lxml not finding a document tree. * Parse the document encoding from the XML tag.
* Try to recover from unknown encodings when previewing media. (#9164)Patrick Cloke2021-01-261-0/+29
| | | | | | Treat unknown encodings (according to lxml) as UTF-8 when generating a preview for HTML documents. This isn't fully accurate, but will hopefully give a reasonable title and summary.
* Skip unit tests which require optional dependencies (#9031)Richard van der Hoff2021-01-071-0/+11
| | | If we are lacking an optional dependency, skip the tests that rely on it.
* Do not raise a 500 exception when previewing empty media. (#8883)Patrick Cloke2020-12-071-11/+16
|
* Run Black. (#5482)Amber Brown2019-06-201-68/+68
|
* Run black.black2018-08-101-38/+17
|
* run isortAmber Brown2018-07-091-3/+4
|
* Fix crash in url preview when html tag has no textMarcin Bachry2016-12-141-0/+50
| | | | Signed-off-by: Marcin Bachry <hegel666@gmail.com>
* test_preview: Fix incorrect wrappingJohannes Löthberg2016-12-051-2/+2
| | | | | | | The old test expected an incorrect wrapping due to the preview function not using unicode properly, so it got the wrong length. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Make test_preview use unicode stringsJohannes Löthberg2016-12-051-68/+68
| | | | Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
* Fix up preview URL API. Add tests.Erik Johnston2016-08-161-1/+79
| | | | | | | | | This includes: - Splitting out methods of a class into stand alone functions, to make them easier to test. - Adding unit tests to split out functions, testing HTML -> preview. - Handle the fact that elements in lxml may have tail text.
* Test summarizationErik Johnston2016-08-041-0/+139