File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,14 @@ async def _connect(self):
3131 r = r .decode ('utf-8' )
3232 msg = json .loads (r )
3333
34- if 'data' not in msg or msg ['data' ]['status' ] != 'authorized' :
34+ if not 'data' in msg or msg ['data' ]['status' ] != 'authorized' :
3535 raise ValueError (
3636 ("Invalid Alpaca API credentials, Failed to authenticate: {}"
3737 .format (msg ))
3838 )
3939
4040 self ._ws = ws
41- await self ._dispatch ('authenticated ' , msg )
41+ await self ._dispatch ('authorized ' , msg )
4242
4343 asyncio .ensure_future (self ._consume_msg ())
4444 return ws
Original file line number Diff line number Diff line change @@ -38,21 +38,21 @@ def test_stream(websockets):
3838 ws .recv = AsyncMock (return_value = json .dumps ({
3939 'stream' : 'authentication' ,
4040 'data' : {
41- 'status' : 'authenticated ' ,
41+ 'status' : 'authorized ' ,
4242 }
4343 }).encode ())
4444
4545 conn = StreamConn ('key-id' , 'secret-key' )
4646 conn ._consume_msg = AsyncMock ()
4747
48- @conn .on ('authenticated ' )
48+ @conn .on ('authorized ' )
4949 async def on_auth (conn , stream , msg ):
5050 on_auth .msg = msg
5151 _run (conn ._connect ())
52- assert on_auth .msg .status == 'authenticated '
52+ assert on_auth .msg .status == 'authorized '
5353 assert conn ._consume_msg .mock .called
5454
55- conn .deregister ('authenticated ' )
55+ conn .deregister ('authorized ' )
5656 assert len (conn ._handlers ) == 0
5757
5858 with pytest .raises (ValueError ):
You can’t perform that action at this time.
0 commit comments