Conversation
|
@quaxsze some hell broke loose in the tests because udata/udata/core/user/views.py Line 63 in 9bc0f73 |
|
How did you pick the signals to plug in ? For example, don't we want to add the signals for resources addition and deletion ( |
|
|
||
|
|
||
| @Dataset.on_delete.connect | ||
| def on_dataset_delete(dataset): |
There was a problem hiding this comment.
Don't we want to add the if not dataset.private condition on dataset deletion ?
| updates, _ = dataset._delta() | ||
| if 'private' in updates and not dataset.private: | ||
| dispatch('datagouvfr.dataset.created', dataset.to_json()) | ||
| else: |
There was a problem hiding this comment.
I'm confused by the logic on dataset privacy here. If an update is made on a private dataset, we're going to dispatch the updated signal?
| assert True | ||
|
|
||
| def test_webhooks_task(self, rmock): | ||
| '''NB: apparently celery task errors don't surface so we need to test them directly''' |
There was a problem hiding this comment.
Why is this NB here, as we don't test task errors in this particular test? Maybe move it somewhere else?
|
|
||
|
|
||
| @on_new_discussion.connect | ||
| def on_new_discussion(discussion): |
There was a problem hiding this comment.
Same question on discussion events, don't we want to add the if not dataset.private condition on dataset deletion ?
A naive approach at dispatching webhooks.
For now, only the dispatch logic is here, we still need to plug it to signals (dataset created...).Plugged-in signals:
Also, some linting changes: enforce single quotes through flake8, lint legacy files as I go through them.
This is designed to work with https://github.com/abulte/chatelet, but it's pretty generic in the end: send a
POSTrequest to a designated URL.