-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathutil.py
More file actions
49 lines (42 loc) · 1.29 KB
/
util.py
File metadata and controls
49 lines (42 loc) · 1.29 KB
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
46
47
48
49
import unittest
import datetime
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',
},
'starts': datetime.datetime(2017,01,10)
}
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',
'starts': 1484006400,
}
self.assertEqual(after, util.serialize(before))