tests: Unescape the html generated in curl example test.

Curl examples generated in test_generated_curl_examples_for_success
used to be html escaped. This commit removes the escaping in the test
since curl examples are not html escaped when run from terminal.
This commit is contained in:
Vishnu Ks 2019-11-18 04:33:34 +00:00 committed by Tim Abbott
parent a478e861a2
commit ec53b8c574
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import shlex
import subprocess
import markdown
import os
import html
from zulip import Client
from zerver.lib.bugdown import api_code_examples
@ -44,7 +45,8 @@ def test_generated_curl_examples_for_success(client: Client) -> None:
# markdown rendering pipeline to compute the user-facing
# example, and then run that to test it.
curl_command_html = md_engine.convert(line.strip())
curl_command_text = curl_command_html[len("<p><code>curl\n"):-len("</code></p>")]
unescaped_html = html.unescape(curl_command_html)
curl_command_text = unescaped_html[len("<p><code>curl\n"):-len("</code></p>")]
curl_command_text = curl_command_text.replace(
"BOT_EMAIL_ADDRESS:BOT_API_KEY", authentication_line)