def test_accounts_no_accountIDs(self): from tdameritrade import TDClient with patch('tdameritrade.session.TDASession.request') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [MagicMock()] tdc = TDClient( client_id=123, refresh_token='reftoken', ) tdc.accounts()
def test_accounts(self): from tdameritrade import TDClient tdc = TDClient('test', [1, 2]) with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [MagicMock()] tdc.accounts() tdc = TDClient('test', [1, 2]) with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [MagicMock()] with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [{'test': 1, 'test2': 2}] tdc.accountsDF()
def test_accounts(self, mock_rtie): from tdameritrade import TDClient tdc = TDClient(clientId=123, refreshToken='reftoken', accountIds=[1, 2]) with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [MagicMock()] tdc.accounts() tdc = TDClient(clientId=123, refreshToken='reftoken', accountIds=[1, 2]) with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [MagicMock()] with patch('requests.get') as m: m.return_value.status_code = 200 m.return_value.json.return_value = [{'test': 1, 'test2': 2}] tdc.accountsDF()
#print(driver.page_source) def timeout(): print("Alarm!") timer = Timer(1500.0, timeout) timer.start() response = au.refresh_token(REFRESH_TOKEN, 'CHARLIEQ') print(response) c = TDClient(response['access_token']) c.accounts() #access_Trade(html) again = True while again: #print("current Price") if timer.is_alive() == False: print("STOPPED") response = au.refresh_token(REFRESH_TOKEN, 'CHARLIEQ') c = TDClient(response['access_token']) c.accounts() timer = Timer(1500.0, timeout) timer.start()