File: util.py

package info (click to toggle)
chargebee-python 1.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 484 kB
  • sloc: python: 1,008; makefile: 6; sh: 3
file content (45 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import unittest

from chargebee import util


class UtilTest(unittest.TestCase):

    def test_serialize(self):
        before = {
            'id': 'sub_KyVq7DNSNM7CSD',
            'plan_id': 'free',
            'addons': (
                {
                    'id': 'monitor',
                    'quantity': 2,
                },
                {
                    'id': 'ssl',
                }
            ),
            'card': {
                'first_name': 'Rajaraman',
                'last_name': 'Santhanam',
                'number': '4111111111111111',
                'expiry_month': '1',
                'expiry_year': '2024',
                'cvv': '007',
            }
        }

        after = {
            'id': 'sub_KyVq7DNSNM7CSD',
            'plan_id': 'free',
            'addons[id][0]': 'monitor',
            'addons[quantity][0]': 2,
            'addons[id][1]': 'ssl',
            'card[first_name]': 'Rajaraman',
            'card[last_name]': 'Santhanam',
            'card[number]': '4111111111111111',
            'card[expiry_month]': '1',
            'card[expiry_year]': '2024',
            'card[cvv]': '007',
        }

        self.assertEqual(after, util.serialize(before))