mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 12:54:58 +00:00
populate_db: Add images in test data.
This isn't quite the right model, because we're not actually going through the upload code path, but it does at least provide some inline image previews in the data. Fixes part of #14991.
This commit is contained in:
@@ -54,6 +54,7 @@ def load_generators(config: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
results["inline-code"] = itertools.cycle(cfg["inline-code"])
|
results["inline-code"] = itertools.cycle(cfg["inline-code"])
|
||||||
results["code-blocks"] = itertools.cycle(cfg["code-blocks"])
|
results["code-blocks"] = itertools.cycle(cfg["code-blocks"])
|
||||||
results["quote-blocks"] = itertools.cycle(cfg["quote-blocks"])
|
results["quote-blocks"] = itertools.cycle(cfg["quote-blocks"])
|
||||||
|
results["images"] = itertools.cycle(cfg["images"])
|
||||||
|
|
||||||
results["lists"] = itertools.cycle(cfg["lists"])
|
results["lists"] = itertools.cycle(cfg["lists"])
|
||||||
|
|
||||||
@@ -120,8 +121,14 @@ def add_flair(paragraphs: List[str], gens: Dict[str, Any]) -> List[str]:
|
|||||||
txt = add_emoji(paragraphs[i], next(gens["emojis"]))
|
txt = add_emoji(paragraphs[i], next(gens["emojis"]))
|
||||||
elif key == "link":
|
elif key == "link":
|
||||||
txt = add_link(paragraphs[i], next(gens["links"]))
|
txt = add_link(paragraphs[i], next(gens["links"]))
|
||||||
elif key == "picture":
|
elif key == "images":
|
||||||
txt = txt # TODO: implement pictures
|
# Ideally, this would actually be a 2-step process that
|
||||||
|
# first hits the `upload` endpoint and then adds that URL;
|
||||||
|
# this is the hacky version where we just use inline image
|
||||||
|
# previews of files already in the project (which are the
|
||||||
|
# only files we can link to as being definitely available
|
||||||
|
# even when developing offline).
|
||||||
|
txt = paragraphs[i] + "\n" + next(gens["images"])
|
||||||
|
|
||||||
results.append(txt)
|
results.append(txt)
|
||||||
|
|
||||||
|
|||||||
12
zerver/tests/fixtures/config.generate_data.json
vendored
12
zerver/tests/fixtures/config.generate_data.json
vendored
@@ -44,6 +44,16 @@
|
|||||||
"```quote\nAny sufficiently advanced technology is indistinguishable from magic.\n -- Arthur C. Clarke\n```"
|
"```quote\nAny sufficiently advanced technology is indistinguishable from magic.\n -- Arthur C. Clarke\n```"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"images": [
|
||||||
|
"[whale](/static/images/features/whale.png)\n",
|
||||||
|
"[twitter](/static/images/features/twitter.png)\n",
|
||||||
|
"[topics](/static/images/story-tutorial/zulip-topic.png)\n",
|
||||||
|
"[On_it!](/static/images/story-tutorial/zulip-compose.png)\n",
|
||||||
|
"[streams](/static/images/story-tutorial/zulip-streams.png)\n",
|
||||||
|
"[stream_selected](/static/images/story-tutorial/zulip-streams-selected-original.png)\n",
|
||||||
|
"[unreads](/static/images/story-tutorial/zulip-streams-unreads.png)\n"
|
||||||
|
],
|
||||||
|
|
||||||
"maths": [
|
"maths": [
|
||||||
"$$e^{i \\pi } + 1 = 0$$",
|
"$$e^{i \\pi } + 1 = 0$$",
|
||||||
"$$\\frac{1}{\\Gamma(k)\\theta^k x^{k-1} e^{-\\frac{x}{\\theta}}$$"
|
"$$\\frac{1}{\\Gamma(k)\\theta^k x^{k-1} e^{-\\frac{x}{\\theta}}$$"
|
||||||
@@ -67,7 +77,7 @@
|
|||||||
"math": 1,
|
"math": 1,
|
||||||
"link" : 8,
|
"link" : 8,
|
||||||
"list": 5,
|
"list": 5,
|
||||||
"picture" : 0
|
"images" : 5
|
||||||
},
|
},
|
||||||
"corpus":
|
"corpus":
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user