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