def test_all(self):
        connection = MagicMock()
        connection.make_request.return_value = [{'id': 1}, {'id': 2}]

        result = OrderCoupons.all(1, connection, limit=2)
        self.assertEqual(len(result), 2)
        connection.make_request.assert_called_once_with('GET', 'orders/1/coupons', None, {'limit': 2}, None)
Exemplo n.º 2
0
    def test_all(self):
        connection = MagicMock()
        connection.make_request.return_value = [{'id': 1}, {'id': 2}]

        result = OrderCoupons.all(1, connection, limit=2)
        self.assertEqual(len(result), 2)
        connection.make_request.assert_called_once_with(
            'GET', 'orders/1/coupons', None, {'limit': 2}, None)
    def test_get(self):
        connection = MagicMock()
        connection.make_request.return_value = {'id': 2}

        result = OrderCoupons.get(1, 2, connection)
        self.assertIsInstance(result, OrderCoupons)
        self.assertEqual(result.id, 2)

        connection.make_request.assert_called_once_with('GET', 'orders/1/coupons/2', None, {}, None)
Exemplo n.º 4
0
    def test_get(self):
        connection = MagicMock()
        connection.make_request.return_value = {'id': 2}

        result = OrderCoupons.get(1, 2, connection)
        self.assertIsInstance(result, OrderCoupons)
        self.assertEqual(result.id, 2)

        connection.make_request.assert_called_once_with(
            'GET', 'orders/1/coupons/2', None, {}, None)
 def test_parent_id(self):
     coupon = OrderCoupons({'id': 2, 'order_id': 1})
     self.assertEqual(coupon.parent_id(), 1)
Exemplo n.º 6
0
 def test_parent_id(self):
     coupon = OrderCoupons({'id': 2, 'order_id': 1})
     self.assertEqual(coupon.parent_id(), 1)