@@ -930,43 +930,25 @@ def test_genai_vs_ai_exchange(self) -> None:
930930 def test_clarify_followup_uses_history (self ) -> None :
931931 history = [
932932 {
933- "OWASP_AGENT_DB " : "sqlite:////tmp/agent-override.sqlite " ,
934- "DATABASE_URL " : "postgresql://cre:pw@127.0.0.1:5432/cre " ,
933+ "role " : "user " ,
934+ "content " : "What does OWASP membership cost in Switzerland? " ,
935935 },
936- ):
937- self .assertEqual (default_db_path (), "sqlite:////tmp/agent-override.sqlite" )
936+ {
937+ "role" : "assistant" ,
938+ "content" : "Answer: Standard individual dues apply in Switzerland." ,
939+ },
940+ ]
941+ resp = self .router .handle ("and in Morocco?" , history = history )
942+ self .assertIsNotNone (resp )
943+ assert resp is not None
944+ # Combined context should route as membership, not bare clarify miss.
945+ self .assertIn ("owasp_agent" , resp )
946+ kind = resp ["owasp_agent" ]["kind" ]
947+ self .assertIn (kind , ("membership" , "clarify" ))
948+ if kind == "membership" :
949+ self .assertIn ("morocco" , resp ["response" ].lower ())
938950
939- def test_falls_back_to_main_database_url (self ) - > None :
940- env = {
941- k : v
942- for k , v in os .environ .items ()
943- if k
944- not in {
945- "OWASP_AGENT_DB" ,
946- "DATABASE_URL" ,
947- "DEV_DATABASE_URL" ,
948- "PROD_DATABASE_URL" ,
949- "SQLALCHEMY_DATABASE_URI" ,
950- }
951- }
952- env ["DATABASE_URL" ] = "postgresql://cre:pw@127.0.0.1:5432/cre"
953- with patch .dict (os .environ , env , clear = True ):
954- self .assertEqual (
955- default_db_path (), "postgresql://cre:pw@127.0.0.1:5432/cre"
956- )
957951
958- def test_no_sqlite_file_default_when_unset (self ) -> None :
959- drop = {
960- "OWASP_AGENT_DB" ,
961- "DATABASE_URL" ,
962- "DEV_DATABASE_URL" ,
963- "PROD_DATABASE_URL" ,
964- "SQLALCHEMY_DATABASE_URI" ,
965- }
966- env = {k : v for k , v in os .environ .items () if k not in drop }
967- with patch .dict (os .environ , env , clear = True ):
968- with self .assertRaises (RuntimeError ):
969- default_db_path ()
970952
971953
972954
0 commit comments