Esempio n. 1
0
    def test_list(self):
        """Function defined to test paystackapi customer list method."""
        httpretty.register_uri(
            httpretty.GET,
            self.endpoint_url("/customer"),
            content_type='text/json',
            body='{"status": true, "contributors": true}',
            status=201,
        )

        response = Customer.list()
        self.assertEqual(response['status'], True)
    def test_list(self):
        """Function defined to test paystackapi customer list method."""
        httpretty.register_uri(
            httpretty.GET,
            "https://api.paystack.co/customer",
            content_type='text/json',
            body='{"status": true, "contributors": true}',
            status=201,
        )

        response = Customer.list()
        self.assertEqual(response['status'], True)
    def test_list(self):
        """Function defined to test paystackapi customer list method."""
        with mock.patch('paystackapi.customer.Customer.list') as mock_list:
            mock_list.return_value = {
                'status': True, 'message': 'Customers retrieved',
                'meta': {'skipped': 0, 'total': 1, 'page': 1,
                         'perPage': 50, 'pageCount': 1},
                'data': [{'customer_code': 'CUS_jemg85nfijhrp1s',
                          'first_name': 'samuel', 'last_name': 'james',
                          'integration': 100384, 'id': 4013,
                          'phone': '08030495860', 'domain': 'test',
                          'updatedAt': '2016-02-12T12:25:19.000Z',
                          'email': '*****@*****.**',
                          'createdAt': '2016-02-12T12:25:19.000Z',
                          'metadata': None}]
            }

            response = Customer.list()
            self.assertEqual(response['status'], True)