Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
populate_db: Add images in test data.
Ganesh Pawara42f7a67e12b
diff --git a/zerver/lib/generate_test_data.py b/zerver/lib/generate_test_data.pyindex bfe197deb8a..bdd19ad807f 100644--- a/zerver/lib/generate_test_data.py+++ b/zerver/lib/generate_test_data.py@@ -54,6 +54,7 @@ def load_generators(config: Dict[str, Any]) -> Dict[str, Any]:results["inline-code"] = itertools.cycle(cfg["inline-code"])results["code-blocks"] = itertools.cycle(cfg["code-blocks"])results["quote-blocks"] = itertools.cycle(cfg["quote-blocks"])+ results["images"] = itertools.cycle(cfg["images"])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"]))elif key == "link":txt = add_link(paragraphs[i], next(gens["links"]))- elif key == "picture":- txt = txt # TODO: implement pictures+ elif key == "images":+ # 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)diff --git a/zerver/tests/fixtures/config.generate_data.json b/zerver/tests/fixtures/config.generate_data.jsonindex ae261a34580..047119207e2 100644--- a/zerver/tests/fixtures/config.generate_data.json+++ b/zerver/tests/fixtures/config.generate_data.json@@ -44,6 +44,16 @@"```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": ["$$e^{i \\pi } + 1 = 0$$","$$\\frac{1}{\\Gamma(k)\\theta^k x^{k-1} e^{-\\frac{x}{\\theta}}$$"@@ -67,7 +77,7 @@"math": 1,"link" : 8,"list": 5,- "picture" : 0+ "images" : 5},"corpus":{