Exemplo n.º 1
0
 def test_list_orders_with_filters(self):
     moip = Moip(token, key)
     order = self._create_basic_protected_sale_order()
     moip.create_protected_sale_order(order)
     filters = ListOrdersFilters(offset=10)
     result = moip.list_orders(filters)
     self.assertFalse(result['orders'])
Exemplo n.º 2
0
    def test_get_order_with_more_than_one_device(self):
        """
        It creates a pedido and try to get it, in a way to test if get_pedido
        method works.
        """
        moip = Moip(token, key)

        order = self._create_basic_protected_sale_order()
        order.items[0].quantity = 2
        order_response = moip.create_protected_sale_order(order)
        self.assertEqual(order_response['items'][0]['quantity'], 2)
Exemplo n.º 3
0
 def test_list_orders(self):
     moip = Moip(token, key)
     order = self._create_basic_protected_sale_order()
     moip.create_protected_sale_order(order)
     result = moip.list_orders()
     self.assertEquals(
         sorted([
             u'status', u'customer', u'receivers', u'items', u'events',
             u'amount', u'_links', u'payments', u'updatedAt', u'ownId',
             u'id', u'createdAt', u'blocked'
         ]), sorted(result['orders'][0].keys()))
Exemplo n.º 4
0
    def test_get_order(self):
        """
        It creates a pedido and try to get it, in a way to test if get_pedido
        method works.
        """
        moip = Moip(token, key)

        order_response = moip.create_protected_sale_order(
            self._create_basic_protected_sale_order())
        order = moip.get_order(order_response['id'])
        self.assertEquals(
            sorted([
                u'status', u'customer', u'refunds', u'receivers', u'items',
                u'entries', u'events', u'amount', u'_links', u'payments',
                u'updatedAt', u'ownId', u'shippingAddress', u'id',
                u'createdAt', 'escrows', 'checkoutPreferences'
            ]), sorted(order.keys()))
        self.assertEquals(
            order_response['checkoutPreferences']['installments'][0]
            ['quantity'], [1, 6])
Exemplo n.º 5
0
 def test_create_protected_sale_order_error(self):
     moip = Moip(token, key)
     self.assertRaises(AssertionError, moip.create_protected_sale_order, {})
Exemplo n.º 6
0
 def test_create_protected_sale_order_type_ok(self):
     moip = Moip(token, key)
     order = self._create_basic_protected_sale_order()
     moip.create_protected_sale_order(order)
Exemplo n.º 7
0
 def test_list_customers_auth_problem(self):
     moip = Moip('', '')
     self.assertRaises(MoipAuthorizationException, moip.list_customers)
Exemplo n.º 8
0
 def test_list_customers_ok(self):
     moip = Moip(token, key)
     # if there is problem, it will generate an exception
     moip.list_customers()
Exemplo n.º 9
0
 def test_production_sandbox(self):
     moip = Moip(token, key)
     moip.sandbox()
     self.assertEqual(moip._url, Moip.url_sandbox)
     moip.production()
     self.assertEqual(moip._url, Moip.url_production)