Skip to content

Commit

Permalink
Added place_order tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgolec committed May 4, 2024
1 parent 5ac64e7 commit 0333654
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,31 @@ def test_get_orders_for_all_linked_accounts_status_unchecked(self):
})


# place_order


def test_place_order(self):
order_spec = {'order': 'spec'}
self.client.place_order(ACCOUNT_HASH, order_spec)
self.mock_session.post.assert_called_once_with(
self.make_url('/trader/v1/accounts/{accountHash}/orders'), json=order_spec)


def test_place_order_order_builder(self):
order_spec = OrderBuilder(enforce_enums=False).set_order_type('LIMIT')
expected_spec = {'orderType': 'LIMIT'}
self.client.place_order(ACCOUNT_HASH, order_spec)
self.mock_session.post.assert_called_once_with(
self.make_url('/trader/v1/accounts/{accountHash}/orders'),
json=expected_spec)


def test_place_order_str(self):
order_spec = {'order': 'spec'}
self.client.place_order(str(ACCOUNT_HASH), order_spec)
self.mock_session.post.assert_called_once_with(
self.make_url('/trader/v1/accounts/{accountHash}/orders'), json=order_spec)

# get_price_history


Expand Down

0 comments on commit 0333654

Please sign in to comment.