| 4 | |
| 5 | |
| 6 | def test_bash_run(): |
| 7 | # Test without sources |
| 8 | output = bash_run("echo 'Hello, World!'", capture_output=True) |
| 9 | assert output.stdout.strip() == "Hello, World!" |
| 10 | |
| 11 | # Test with sources |
| 12 | with ( |
| 13 | tempfile.NamedTemporaryFile(mode="w", delete_on_close=False) as source1, |
| 14 | tempfile.NamedTemporaryFile(mode="w", delete_on_close=False) as source2, |
| 15 | ): |
| 16 | source1.write("export VAR1=source1") |
| 17 | source2.write("export VAR2=source2") |
| 18 | source1.close() |
| 19 | source2.close() |
| 20 | |
| 21 | output = bash_run( |
| 22 | "echo $VAR1 $VAR2", |
| 23 | sources=[source1.name, source2.name], |
| 24 | capture_output=True, |
| 25 | ) |
| 26 | assert output.stdout.strip() == "source1 source2" |
| 27 | |
| 28 | |
| 29 | def test_log_recent_bot_traffic(): |