garnaat / placebo

Make boto3 calls that look real but have no effect.
Apache License 2.0
394 stars 28 forks source link

Need strict mode - rather than cycling back to index 1 #83

Open Johnlon opened 11 months ago

Johnlon commented 11 months ago

I want to be sure that only two calls are made, index 1 and index 2 to an api. At present if a call it made a third time then the library cycles back to index 1 and serves that file instead. What I want instead is the ability to cause a "resource file not found" error.

I can bodge what I need by created a file with index 3 and putting some non-json like the string "POISON-PILL" into the file, but that's not very intuitive.

Perhaps this can be achieved by a change to the Python API?

Perhaps a backwards compat approach would be some logic that has a fallback when "Api_3.json" isn't found then it double checks for a file like "Api_3.unexpected" instead and if found then it aborts rather than cycling back to 1.

I realise on ivestigation that if https://github.com/garnaat/placebo/issues/38 is implemented well then it would probably have exactly the result I want.