def test_party_member_joined(self): test_channel = 'test-channel' Group(PartyConsumer.LOBBY_GROUP.format(self.party.pk)).add(test_channel) PartyConsumer.party_member_joined(party_member=self.party_member) result = self.get_next_message(test_channel, require=True) self.assertEqual( json.loads(result.content['text']), { 'party_member': model_to_dict(self.party_member), 'action': PartyConsumer.PARTY_MEMBER_JOINED, } )
def save(self, *args, **kwargs): if not self.pk: super().save(*args, **kwargs) PartyConsumer.party_member_joined(self) else: super().save(*args, **kwargs)