rebuild website concepts from live design signals
This commit is contained in:
+22
-1
@@ -191,7 +191,28 @@ class BrowserOnlyAppTests(unittest.TestCase):
|
||||
saved = server.db().execute("SELECT ai_probability,ai_recommendation,ai_reasoning FROM prospects WHERE id=1").fetchone()
|
||||
self.assertEqual(tuple(saved), (84.0, "contact", "Active business with a clear website opportunity."))
|
||||
|
||||
def test_mockup_fallback_is_saved_and_public_share_link_works(self):
|
||||
def test_live_site_snapshot_captures_design_signals_for_generation(self):
|
||||
class Response:
|
||||
headers = {"Content-Type": "text/html; charset=utf-8"}
|
||||
def __enter__(self): return self
|
||||
def __exit__(self, *args): return None
|
||||
def read(self, limit): return b'''<html class="brand-site"><head><title>Acme</title><style>:root{--brand:#123456} body{font-family: Georgia}</style></head><body><nav><a href="/services">Services</a></nav><main><h1>Acme Plumbing</h1><section class="hero dark"><img src="https://example.com/hero.jpg"><h2>Fast help</h2></section></main></body></html>'''
|
||||
def geturl(self): return "https://acme.example/"
|
||||
with patch("api.server._safe_url", return_value=True), patch("api.server.urllib.request.urlopen", return_value=Response()):
|
||||
snapshot = server.fetch_company_page("https://acme.example/")
|
||||
self.assertIn("hero", snapshot["website_design_brief"])
|
||||
self.assertIn("#123456", snapshot["website_design_brief"])
|
||||
self.assertIn("Georgia", snapshot["website_design_brief"])
|
||||
self.assertIn("https://example.com/hero.jpg", snapshot["website_design_brief"])
|
||||
|
||||
def test_rendered_design_variants_are_not_the_same_template(self):
|
||||
prospect = {"name": "Acme Plumbing", "category": "plumbers", "address": "Cape Town"}
|
||||
first = server.premium_render_pages(prospect, {}, mode="onepage", design={"variant": "midnight", "layout": "editorial", "radius": "sharp"})["home"]
|
||||
second = server.premium_render_pages(prospect, {}, mode="onepage", design={"variant": "warm", "layout": "bento", "radius": "soft"})["home"]
|
||||
self.assertNotEqual(first, second)
|
||||
self.assertIn("layout-editorial", first)
|
||||
self.assertIn("layout-bento", second)
|
||||
|
||||
conn = server.db()
|
||||
conn.execute("INSERT INTO prospects(name,domain,category,address,phone,emails,website,website_status,discovered_at) VALUES(?,?,?,?,?,?,?,?,?)", ("Acme Plumbing", "maps:acme", "plumbers", "Cape Town", "+27101234567", "info@acme.co.za", "", "no_detected_website", server.now()))
|
||||
conn.commit(); conn.close()
|
||||
|
||||
Reference in New Issue
Block a user