Integrate Content Editor and Publication workflow
This commit is contained in:
@@ -97,7 +97,7 @@ with TestClient(app) as client:
|
||||
assert response.status_code==200
|
||||
response=client.get('/admin/pages/index')
|
||||
assert response.status_code==200 and 'document-editor' in response.text
|
||||
for name in ('antirion-rework.css','shell.css','pages.css','pages.js','admin.css','admin.js','editor.js','preview-update.js','builder.css','builder-adapter.css','builder.js','htmx.min.js','theme-studio.css','theme-studio.js'):
|
||||
for name in ('antirion-rework.css','shell.css','pages.css','pages.js','admin.css','admin.js','editor.js','preview-update.js','builder.css','builder-adapter.css','builder.js','htmx.min.js','theme-studio.css','theme-studio.js','content-editor.css','content-adapter.css','content-editor.js','favicon.svg','publication.css','publication-adapter.css','publication.js','publication-icons.json'):
|
||||
assert client.get('/admin/static/'+name).status_code==200,name
|
||||
assert 'pages-screen' in client.get('/admin/pages').text
|
||||
cookie=client.cookies.get('se_session')
|
||||
@@ -139,8 +139,31 @@ with TestClient(app) as client:
|
||||
result=preview.get(result.json()['url'])
|
||||
assert result.status_code==200 and 'sample-site' in result.text,result.text
|
||||
assert '--color-primary: #a48bfa' in result.text
|
||||
response=client.get('/admin/content/services/bots')
|
||||
assert response.status_code==200 and 'entry-workspace' in response.text,response.text
|
||||
from site_engine.services.entries import EntryService
|
||||
entry=EntryService(Path(os.environ['SITE_ROOT']),collection='services').get('bots')
|
||||
result=client.post('/admin/editor/content/services/bots/update',data={'csrf':csrf,'payload':json.dumps({'source':entry.source,'etag':entry.etag,'revision':30,'preview_view':'card'})},headers={'Origin':'http://testserver','HX-Request':'true','Accept':'application/json'})
|
||||
assert result.status_code==200 and 'f-entry_card' in result.json()['preview']['html'],result.text
|
||||
assert 'data-content-tab' in result.json()['projection']
|
||||
assert 'data-publication-root' in client.get('/admin/publish').text
|
||||
def publication(op, payload=None):
|
||||
return client.post('/admin/publication/'+op,data={'csrf':csrf,'payload':json.dumps(payload or {})},headers={'Origin':'http://testserver','Accept':'application/json'})
|
||||
live=(Path(os.environ['SITE_DIST'])/'current').resolve().name
|
||||
candidate=publication('build')
|
||||
assert candidate.status_code==200,candidate.text
|
||||
identity=candidate.json()['id']
|
||||
assert (Path(os.environ['SITE_DIST'])/'current').resolve().name==live
|
||||
passive=publication('preview',{'id':identity,'route':'/'})
|
||||
assert passive.status_code==200,passive.text
|
||||
with TestClient(create_preview_app()) as preview:
|
||||
result=preview.get(passive.json()['url'])
|
||||
assert result.status_code==200 and '<script' not in result.text,result.text
|
||||
result=publication('activate',{'id':identity,'expected_live':live,'comment':'Installed wheel release'})
|
||||
assert result.status_code==200,result.text
|
||||
assert (Path(os.environ['SITE_DIST'])/'current').resolve().name==identity
|
||||
assert app.state.api_calls>0
|
||||
print('installed wheel: all theme presets, build, widths, static, templates, Theme Manager, API, background update, bridge, separate preview OK; design/ absent')
|
||||
print('installed wheel: all theme presets, build, widths, static, templates, Theme Manager, Content Editor, Publication candidates/preview/activation, API, background update, bridge, separate preview OK; design/ absent')
|
||||
"""
|
||||
subprocess.run([sys.executable, "-c", program], cwd=work, env=env, check=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user