Beautiful will does not parse HTML entities like `'` as we expect
and the previous logic of replacing this *after* HTML parsing occurred
did not produced expected results.
To illustrate this, we change data in "test_timeline" to include a
literal `'` as it sometimes occur in data returned by Mastodon API.
New HTML content is:
<p>The computer can't tell you the emotional story [...] </p>
Beautiful will parse this as as:
<p>The computer can&apost tell you the emotional story [...] </p>
which is not what we expect.
We fix this by replacing `'` *before* HTML parsing by Beautiful.
Since test data in "test_timeline" got updated we also add an extra
assertion checking that part of the content with a literal "'" is
(still) properly rendered.
According to the Python documentation[1]:
> Calls to unsetenv() don’t update os.environ, so it is actually
> preferable to delete items of os.environ.
It means that os.unsetenv is not enough to remove an entry from
os.environ. This is why the following test was failing:
os.unsetenv('XDG_CONFIG_HOME')
assert fn() == os.path.expanduser('~/.config/toot/config.json')
os.unsetenv did not influence the output of the subsequent call to
os.getenv() in get_config_file_path(). As a result the original value
was returned instead of the fallback value of '~/.config'.
This bug was discovered during porting toot to FreeBSD as the FreeBSD
Ports framework passes XDG_CONFIG_HOME to make's environment.
[1]: https://docs.python.org/3.6/library/os.html#os.unsetenv