コード例 #1
0
    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()
コード例 #2
0
ファイル: test_client.py プロジェクト: pkout/tdameritrade
    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()