feat(ui): replace configuration editors with graphical forms
This commit is contained in:
@@ -7,6 +7,7 @@ from http.cookiejar import CookieJar
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import secrets
|
||||
import socket
|
||||
import ssl
|
||||
@@ -77,13 +78,18 @@ def main():
|
||||
form = urllib.parse.urlencode({"username":"smoke-admin","password":password}).encode()
|
||||
with opener.open(urllib.request.Request(base+"/auth/login",data=form,headers={"Origin":base}),timeout=5) as response:
|
||||
assert response.status == 200
|
||||
assert b"/static/app.js" in response.read()
|
||||
page = response.read()
|
||||
assert b"/static/app.js" in page
|
||||
with request("/api/v1/me") as response:
|
||||
csrf = json.load(response)["csrf_token"]
|
||||
with request("/api/v1/hosts",{"fqdn":"smoke.example.net","site":"isolated-test","management_ip":"192.0.2.11/24","identities":[{"kind":"serial","value":"SMOKE-ONLY"}]},csrf) as response:
|
||||
host_id = json.load(response)["id"]
|
||||
with opener.open(base+"/static/app.js",timeout=5) as response:
|
||||
assert response.status == 200 and len(response.read())>1000
|
||||
assets = set(re.findall(rb'(?:src|href)="(/static/[^\"]+)"', page))
|
||||
assert b"/static/installation-form.js" in assets
|
||||
assert b"/static/module-forms.js" in assets
|
||||
for asset in assets:
|
||||
with opener.open(base+asset.decode(),timeout=5) as response:
|
||||
assert response.status == 200 and response.read(), asset
|
||||
process.terminate()
|
||||
process.wait(timeout=15)
|
||||
process = start()
|
||||
|
||||
Reference in New Issue
Block a user