예제 #1
0
파일: tests.py 프로젝트: ruhan/python-moip
 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'])
예제 #2
0
파일: tests.py 프로젝트: ruhan/python-moip
    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)
예제 #3
0
파일: tests.py 프로젝트: ruhan/python-moip
 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()))
예제 #4
0
파일: tests.py 프로젝트: ruhan/python-moip
    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])
예제 #5
0
파일: tests.py 프로젝트: ruhan/python-moip
 def test_create_protected_sale_order_error(self):
     moip = Moip(token, key)
     self.assertRaises(AssertionError, moip.create_protected_sale_order, {})
예제 #6
0
파일: tests.py 프로젝트: ruhan/python-moip
 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)
예제 #7
0
파일: tests.py 프로젝트: ruhan/python-moip
 def test_list_customers_auth_problem(self):
     moip = Moip('', '')
     self.assertRaises(MoipAuthorizationException, moip.list_customers)
예제 #8
0
파일: tests.py 프로젝트: ruhan/python-moip
 def test_list_customers_ok(self):
     moip = Moip(token, key)
     # if there is problem, it will generate an exception
     moip.list_customers()
예제 #9
0
파일: tests.py 프로젝트: ruhan/python-moip
 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)