danger / peril

☢️ Serious and immediate danger.
https://danger.systems
MIT License
461 stars 58 forks source link

[Dev Happiness] Add a simple set of testing functions to mock webhooks #30

Open deecewan opened 7 years ago

deecewan commented 7 years ago

On a separate project I work on, I have set up a small script that allows you to specify a webhook mock, and a function, and it calls that particular function with the mocked hook.

For instance, I have a few JSON files containing push webhook request JSON details.

On the CLI, I can call ./tools/testhook <fn-name> <webhook-type> and it will call the correct function and pass in the webhook data.

I'll be honest, I haven't read through the code yet, but that should make debugging a lot easier.

If people are keen for this, I'll open a PR.

orta commented 7 years ago

Ah yeah, debugging is really slow in Peril

I'e also been putting every JSON response that is used inside the repo, so in theory we can self-host those. I've also been wanting to start upping the ability to TDD in here when I get back from my honeymoon

deecewan commented 7 years ago

I haven't actually looked at this repo yet (i thought it was a private project tbh). That's cool.

yeah, a fast test cycle that doesn't include ngrok and resending github requests is (imo) the best way to get it done.

orta commented 7 years ago

Aye, I want to start hosting this first for Artsy, then one for the web in general so people don't have to use a CI runner to execute Danger

deecewan commented 7 years ago

if this project is OSS tho, does that mean I could host my own danger runner, for instance?

danger-systems commented 7 years ago

Yep, think it's being used privately in docker too. All the pieces work, but it's still a bit of a faff to set up.

On Mar 15, 2017 11:00 AM, "David Buchan-Swanson" notifications@github.com wrote:

if this project is OSS tho, does that mean I could host my own danger runner, for instance?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danger/peril/issues/30#issuecomment-286618516, or mute the thread https://github.com/notifications/unsubscribe-auth/ATVFrn38BRC0Y8MrZAvABq7xpbXZaly4ks5rl0ZOgaJpZM4McdoH .