forked from glim/rest-api-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.py
More file actions
21 lines (17 loc) · 741 Bytes
/
util_test.py
File metadata and controls
21 lines (17 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import paypalrestsdk.util as util
import unittest
class TestUtil(unittest.TestCase):
def test_join_url(self):
url = util.join_url("payment", "1")
self.assertEqual(url, "payment/1")
url = util.join_url("payment/", "1")
self.assertEqual(url, "payment/1")
url = util.join_url("payment", "/1")
self.assertEqual(url, "payment/1")
url = util.join_url("payment/", "/1")
self.assertEqual(url, "payment/1")
def test_join_url_params(self):
url = util.join_url_params("payment", { "count": 1 })
self.assertEqual(url, "payment?count=1")
url = util.join_url_params("payment", { "count": 1, "next_id": 4321 })
self.assertTrue(url in ("payment?count=1&next_id=4321", "payment?next_id=4321&count=1"))