Post Submit Hook

Issue #303 open
Ben Earner created an issue

Would it be possible to calculate a test only when the test has been submitted? An example use case would be to interact with a 3rd party API where by we don't want the code to be fired off every time a test value in the calculation context is updated. I think this would have to be a setting for the test in the admin interface.

Pseudo api code:

if post_api == 1:
    #Some json payload based upon calculation context
    payload = {...}
    r = requests.post('http://myapisite.json', json=payload)
    result = "Submitted"

At the same time it would also be useful to access the comments as meta data but I should probably raise that as a separate feature request, depending on the thoughts on this request.

Comments (6)

  1. Randle Taylor

    Hi Ben,

    Funny timing as just a few days ago I was considering the addition of adding a "post submit hook" that would allow people to run custom code after a test list was submitted for the exact scenario you describe. It could also be used to fire off emails, notifications etc. Then I thought maybe nobody would use it so it's good to hear I was wrong about that.

    Probably won't make it into the next release, but it's definitely something I'm interested in implementing. Thanks for chiming in :)

  2. Randle Taylor

    Also, there's already a request open for interacting with comments as part of calculations, so if there is any specific use cases you have, it might be useful to post them there to help guide development of that feature.

  3. Log in to comment