Skip to content

Commit

Permalink
fixes import and adds invocation test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgolec committed May 14, 2024
1 parent 85241ed commit af0138f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/schwab-order-codegen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
from tda.scripts.orders_codegen import latest_order_main
from schwab.scripts.orders_codegen import latest_order_main

if __name__ == '__main__':
import sys
Expand Down
12 changes: 12 additions & 0 deletions tests/scripts/orders_codegen_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
import unittest
from unittest.mock import call, MagicMock, patch

Expand Down Expand Up @@ -203,3 +204,14 @@ def test_account_id_error(
mock_construct_repeat_order.assert_not_called
mock_print.assert_called_once_with(
AnyStringWith('TDA returned error: "invalid"'))


class ScriptInvocationTest(unittest.TestCase):

def test_get_help(self):
res = subprocess.run(
'schwab-order-codegen.py --help',
shell=True, check=True, text=True, capture_output=True)
print(res.stdout)
self.assertIn('Utilities for generating code from historical orders',
res.stdout)

0 comments on commit af0138f

Please sign in to comment.