File tree 3 files changed +70
-0
lines changed
test_configs/flows/print_secret_flow
3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -1407,3 +1407,45 @@ def test_flow_test_with_image_input_and_output(self):
1407
1407
assert output_path .exists ()
1408
1408
image_path = Path (FLOWS_DIR ) / "python_tool_with_image_input_and_output" / ".promptflow" / "intermediate"
1409
1409
assert image_path .exists ()
1410
+
1411
+ def test_data_scrubbing (self ):
1412
+ # Prepare connection
1413
+ run_pf_command (
1414
+ "connection" ,
1415
+ "create" ,
1416
+ "--file" ,
1417
+ f"{ CONNECTIONS_DIR } /custom_connection.yaml" ,
1418
+ "--name" ,
1419
+ "custom_connection" )
1420
+ # Test flow run
1421
+ run_pf_command (
1422
+ "flow" ,
1423
+ "test" ,
1424
+ "--flow" ,
1425
+ f"{ FLOWS_DIR } /print_secret_flow" ,
1426
+ )
1427
+ output_path = Path (FLOWS_DIR ) / "print_secret_flow" / ".promptflow" / "flow.output.json"
1428
+ assert output_path .exists ()
1429
+ log_path = Path (FLOWS_DIR ) / "print_secret_flow" / ".promptflow" / "flow.log"
1430
+ with open (log_path , "r" ) as f :
1431
+ log_content = f .read ()
1432
+ assert "**data_scrubbed**" in log_content
1433
+
1434
+ # Test node run
1435
+ run_pf_command (
1436
+ "flow" ,
1437
+ "test" ,
1438
+ "--flow" ,
1439
+ f"{ FLOWS_DIR } /print_secret_flow" ,
1440
+ "--node" ,
1441
+ "print_secret" ,
1442
+ "--inputs" ,
1443
+ "conn=custom_connection" ,
1444
+ "inputs.topic=atom"
1445
+ )
1446
+ output_path = Path (FLOWS_DIR ) / "print_secret_flow" / ".promptflow" / "flow-print_secret.node.detail.json"
1447
+ assert output_path .exists ()
1448
+ log_path = Path (FLOWS_DIR ) / "print_secret_flow" / ".promptflow" / "print_secret.node.log"
1449
+ with open (log_path , "r" ) as f :
1450
+ log_content = f .read ()
1451
+ assert "**data_scrubbed**" in log_content
Original file line number Diff line number Diff line change
1
+ inputs :
2
+ key :
3
+ type : string
4
+ default : text
5
+ outputs :
6
+ output :
7
+ type : string
8
+ reference : ${print_secret.output}
9
+ nodes :
10
+ - name : print_secret
11
+ type : python
12
+ source :
13
+ type : code
14
+ path : print_secret.py
15
+ inputs :
16
+ connection : custom_connection
17
+ text : ${inputs.key}
Original file line number Diff line number Diff line change
1
+ import os
2
+
3
+ from promptflow import tool
4
+ from promptflow .connections import CustomConnection
5
+
6
+
7
+ @tool
8
+ def print_secret (text : str , connection : CustomConnection ):
9
+ print (connection ["key1" ])
10
+ print (connection ["key2" ])
11
+ return text
You can’t perform that action at this time.
0 commit comments