Re: Testing Channels 2.0 consumers - problem with routing

2018-02-11 Thread Andrew Godwin
Hi, This is a known issue with the Redis backend - https://github.com/django/channels/issues/859 I am looking at it today. Andrew On Sun, Feb 11, 2018 at 8:54 AM, Azamat Galimzhanov wrote: > After fixing this issue, here is the updated consumer: > > > from functools

Re: Testing Channels 2.0 consumers - problem with routing

2018-02-11 Thread Azamat Galimzhanov
After fixing this issue, here is the updated consumer: from functools import lru_cache from asgiref.sync import AsyncToSync from channels.generic.websocket import WebsocketConsumer class AuctionConsumer(WebsocketConsumer): @property @lru_cache(maxsize=None) def group_name(self):

Re: Testing Channels 2.0 consumers - problem with routing

2018-02-09 Thread Andrew Godwin
A disconnect() method in your generic consumer takes one argument, a `close_code` - add that in to your function and it will fix it. Feel free to continue problems in this thread, or you can also use GitHub issues on the channels project if you think they're actual bugs! Andrew On Fri, Feb 9,

Re: Testing Channels 2.0 consumers - problem with routing

2018-02-09 Thread Azamat Galimzhanov
Thanks for reply! self.scope looks like this: {'type': 'websocket', 'path': 'auctions/1/', 'headers': [], 'subprotocols': []} I am not sure why url_route is not there. I rewrote my group_name code to use path instead and now this part works. There is a new error though, during disconnect,

Re: Testing Channels 2.0 consumers - problem with routing

2018-02-07 Thread Andrew Godwin
I'm not going to address the mocking, as there's subtle details there (e.g. you mocked group_name as a non-property, I think), but look at the main issue. Can you make your code print out what _is_ in `self.scope`? url_route should definitely be in there, but I am curious what it looks like if it

Testing Channels 2.0 consumers - problem with routing

2018-02-07 Thread Azamat Galimzhanov
Hello, I'm setting up an auctions application using channels and websockets. When I'm running the server the code works just fine, troubles arise when I'm trying to test my app. asgiref==2.1.3 daphne==2.0.2 Django==2.0.2 channels==2.0.1 channels-redis==2.0.2 pytest==3.4.0 pytest-asyncio==0.8.0