mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-27 17:52:51 +08:00
39 lines
1.7 KiB
Python
39 lines
1.7 KiB
Python
from pathlib import Path
|
|
import unittest
|
|
|
|
|
|
APP_DIR = Path(__file__).resolve().parents[1]
|
|
META_MAKEFILE = APP_DIR.parent / "app-meta-agentflow/Makefile"
|
|
|
|
|
|
class AgentFlowLuciOpenContractTest(unittest.TestCase):
|
|
def read(self, relative):
|
|
return (APP_DIR / relative).read_text(encoding="utf-8")
|
|
|
|
def test_luci_open_delegates_to_shared_apps_entry(self):
|
|
makefile = self.read("Makefile")
|
|
controller = self.read("luasrc/controller/agentflow.lua")
|
|
status = self.read("luasrc/view/agentflow/status.htm")
|
|
meta = META_MAKEFILE.read_text(encoding="utf-8")
|
|
|
|
self.assertIn("+luci-lib-linkeaseauth", makefile)
|
|
self.assertIn("+linkease-app-entry", makefile)
|
|
self.assertIn("PKG_RELEASE:=3", meta)
|
|
self.assertIn("META_LUCI_ENTRY:=/cgi-bin/luci/admin/services/agentflow", meta)
|
|
self.assertIn('entry({"admin", "services", "agentflow", "open"}', controller)
|
|
self.assertIn("open.sysauth = false", controller)
|
|
self.assertIn("function agentflow_open()", controller)
|
|
self.assertIn('compat():open("agentflow")', controller)
|
|
self.assertIn('compat():legacy_status("agentflow"', controller)
|
|
self.assertIn('http = require "luci.http"', controller)
|
|
self.assertIn('resolver = require("luci.model.linkease.apps_openwrt").new()', controller)
|
|
self.assertIn('auth_url = dispatcher.build_url("admin", "services", "linkease_auth", "auth")', controller)
|
|
self.assertNotIn("uhttpd_apps_proxy_available", controller)
|
|
self.assertNotIn("linkeasefull_running", controller)
|
|
self.assertIn('url("admin/services/agentflow/open")', status)
|
|
self.assertNotIn('window.location.hostname + ":" + st.port', status)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|