Skip to content

Commit ee9a974

Browse files
committed
added tests for pull request
1 parent c1b1cdd commit ee9a974

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,31 @@ def woo_test_mock(*args, **kwargs):
7979
status = self.api.get("products").status_code
8080
self.assertEqual(status, 200)
8181

82+
def test_get_with_parameters(self):
83+
""" Test GET requests w/ url params """
84+
@all_requests
85+
def woo_test_mock(*args, **kwargs):
86+
return {'status_code': 200,
87+
'content': 'OK'}
88+
89+
with HTTMock(woo_test_mock):
90+
# call requests
91+
status = self.api.get("products", params={'sku': 10001}).status_code
92+
self.assertEqual(status, 200)
93+
94+
def test_get_with_requests_kwargs(self):
95+
""" Test GET requests w/ optional requests-module kwargs """
96+
97+
@all_requests
98+
def woo_test_mock(*args, **kwargs):
99+
return {'status_code': 200,
100+
'content': 'OK'}
101+
102+
with HTTMock(woo_test_mock):
103+
# call requests
104+
status = self.api.get("products", timeout=60, allow_redirects=True).status_code
105+
self.assertEqual(status, 200)
106+
82107
def test_post(self):
83108
""" Test POST requests """
84109
@all_requests

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy