v0.33.7
This commit is contained in:
1 parent
162e986d37
commit
6b937aaf85
54 files changed
+3527
-1325
No files matched your search
Executable
+18
@@ -0,0 +1,18 @@
|
||||
"""Return the actual assembled embedded Overview HTML to simulated-browser tests."""
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def render_admin_index(root: Path) -> str:
|
||||
web = root / 'src/admin/web'
|
||||
html = (web / 'index.html').read_text(encoding='utf-8')
|
||||
metrics = (web / 'partials/overview-metrics.html').read_text(encoding='utf-8').split('<!-- RP_METRICS_SPLIT -->')
|
||||
charts = (web / 'partials/overview-charts.html').read_text(encoding='utf-8').split('<!-- RP_CHARTS_SPLIT -->')
|
||||
assert len(metrics) == len(charts) == 2
|
||||
for key, fragment in (
|
||||
('METRICS_MAIN', metrics[0]), ('CHARTS_MAIN', charts[0]),
|
||||
('METRICS_WEB', metrics[1]), ('CHARTS_WEB', charts[1]),
|
||||
):
|
||||
marker = '<!-- RP_' + key + ' -->'
|
||||
assert html.count(marker) == 1
|
||||
html = html.replace(marker, fragment)
|
||||
return html
|
||||
Reference in new issue
Block a user