]> git.ipfire.org Git - thirdparty/patchwork.git/commit
tests: Add tests for 'patch-relation-changed' events
authorStephen Finucane <stephen@that.guru>
Sun, 4 Oct 2020 11:03:19 +0000 (12:03 +0100)
committerStephen Finucane <stephen@that.guru>
Sun, 13 Dec 2020 18:30:09 +0000 (18:30 +0000)
commit6d37dcf1f0c53fec8e3b943dc3dcf368099cb4fa
tree55213ead2489f88d0d02bdc759fa58d505a1102e
parentdd19914b99171b73cd2b852cb157274613afe23b
tests: Add tests for 'patch-relation-changed' events

This event is rather odd. If you have two patches then the way a
relation is created is by creating a 'PatchRelation' instance and then
setting the 'related' attribute on the first patch followed by the
second patch. Because the event uses the 'Patch' model's 'pre_save'
signal, we'll only see events for the patch being currently saved. This
means no event will be raised for the first patch and only one event,
the one for the second patch, will be raised when the second patch is
being added to the relationship.

In hindsight, the structure of the event is off. We should have had
something like a 'patch-added-to-relationship' and a
'patch-removed-from-relationship' event, both with the same fields:
'project', 'actor', 'patch' and 'related', the latter of which would
have listed all of the _other_ patches in the relationship. Sadly, this
is an API change which means we can't do it now. We may well wish to do
so in the future though.

Signed-off-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit 8092f8f4f59ea5581180a13994eb090d24394206)
patchwork/tests/test_events.py