Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_create(self):
connection = MagicMock()
connection.make_request.return_value = {'id': 2}
result = OrderShipments.create(1, connection, name="Hello")
self.assertIsInstance(result, OrderShipments)
self.assertEqual(result.id, 2)
connection.make_request.assert_called_once_with('POST', 'orders/1/shipments', {'name': 'Hello'}, None, None)
def test_count_with_custom_count_path(self):
connection = MagicMock()
connection.make_request.return_value = {'count': 2}
self.assertEqual(OrderShipments.count(connection=connection, is_visible=True), 2)
connection.make_request.assert_called_once_with('GET', 'orders/shipments/count',
None, {'is_visible': True}, None)
def test_update(self):
connection = MagicMock()
connection.make_request.return_value = {'id': 1}
order = OrderShipments({'id': 1, 'order_id': 2}, _connection=connection)
new_order = order.update(tracking_number='1234')
self.assertIsInstance(new_order, OrderShipments)
connection.make_request.assert_called_once_with('PUT', 'orders/2/shipments/1', {'tracking_number': '1234'},
None, None)
def test_update(self):
connection = MagicMock()
connection.make_request.return_value = {'id': 1}
order = OrderShipments({'id': 1, 'order_id': 2}, _connection=connection)
new_order = order.update(tracking_number='1234')
self.assertIsInstance(new_order, OrderShipments)
connection.make_request.assert_called_once_with('PUT', 'orders/2/shipments/1', {'tracking_number': '1234'},
None, None)
def test_delete_all(self):
connection = MagicMock()
connection.make_request.return_value = {}
self.assertEqual(OrderShipments.delete_all(1, connection=connection), {})
connection.make_request.assert_called_once_with('DELETE', 'orders/1/shipments', None, None, None)
def test_delete(self):
connection = MagicMock()
connection.make_request.return_value = {}
shipment = OrderShipments({'id': 1, 'order_id': 2, '_connection': connection})
self.assertEqual(shipment.delete(), {})
connection.make_request.assert_called_once_with('DELETE', 'orders/2/shipments/1', None, None, None)
def test_create(self):
connection = MagicMock()
connection.make_request.return_value = {'id': 2}
result = OrderShipments.create(1, connection, name="Hello")
self.assertIsInstance(result, OrderShipments)
self.assertEqual(result.id, 2)
connection.make_request.assert_called_once_with('POST', 'orders/1/shipments', {'name': 'Hello'}, None, None)