| 72 | |
| 73 | @pytest.fixture |
| 74 | async def setup_planning_test(executor, ability, agent, operation, data_svc, event_svc, init_base_world): |
| 75 | texecutor = executor(name='sh', platform='darwin', command='mkdir test', cleanup='rm -rf test') |
| 76 | tability = ability(ability_id='123', executors=[texecutor], repeatable=True, buckets=['test'], name='test1') |
| 77 | tagent = agent(sleep_min=1, sleep_max=2, watchdog=0, executors=['sh'], platform='darwin', |
| 78 | server='http://127.0.0.1:8000') |
| 79 | tsource = Source(id='123', name='test', facts=[], adjustments=[]) |
| 80 | toperation = operation(name='test1', agents=[tagent], |
| 81 | adversary=Adversary(name='test', description='test', |
| 82 | atomic_ordering=[], |
| 83 | adversary_id='XYZ'), |
| 84 | source=tsource) |
| 85 | |
| 86 | cexecutor = executor(name='sh', platform='darwin', command=test_string, cleanup='whoami') |
| 87 | cability = ability(ability_id='321', executors=[cexecutor], singleton=True, name='test2') |
| 88 | |
| 89 | await data_svc.store(tability) |
| 90 | await data_svc.store(cability) |
| 91 | |
| 92 | await data_svc.store( |
| 93 | Obfuscator(name='plain-text', |
| 94 | description='Does no obfuscation to any command, instead running it in plain text', |
| 95 | module='plugins.stockpile.app.obfuscators.plain_text') |
| 96 | ) |
| 97 | |
| 98 | yield tability, tagent, toperation, cability |
| 99 | |
| 100 | |
| 101 | @pytest.fixture(params=stop_bucket_exhaustion_params) |