Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_update_mixin_consumer():
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ('id', 'username', 'email',)
class AConsumer(UpdateModelMixin, GenericAsyncAPIConsumer):
queryset = get_user_model().objects.all()
serializer_class = UserSerializer
assert not get_user_model().objects.all().exists()
# Test a normal connection
communicator = WebsocketCommunicator(AConsumer, "/testws/")
connected, _ = await communicator.connect()
assert connected
await communicator.send_json_to(
{
"action": "update",
"pk": 100,
"data": {
"username": "test101",