iripau 1.1.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iripau-1.1.0 → iripau-1.1.1}/PKG-INFO +1 -1
- {iripau-1.1.0 → iripau-1.1.1}/iripau/requests.py +29 -1
- {iripau-1.1.0 → iripau-1.1.1}/iripau.egg-info/PKG-INFO +1 -1
- {iripau-1.1.0 → iripau-1.1.1}/pyproject.toml +1 -1
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_requests.py +56 -0
- {iripau-1.1.0 → iripau-1.1.1}/LICENSE +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/README.md +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/__init__.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/executable.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/functools.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/logging.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/random.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/shutil.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/subprocess.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau/threading.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau.egg-info/SOURCES.txt +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau.egg-info/dependency_links.txt +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau.egg-info/requires.txt +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/iripau.egg-info/top_level.txt +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/setup.cfg +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_command.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_executable.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_functools.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_logging.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_random.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_shutil.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_subprocess.py +0 -0
- {iripau-1.1.0 → iripau-1.1.1}/tests/test_threading.py +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
A wrapper of the requests module
|
3
3
|
"""
|
4
4
|
|
5
5
|
import requests
|
@@ -79,3 +79,31 @@ class Session(requests.Session):
|
|
79
79
|
echo
|
80
80
|
)
|
81
81
|
return response
|
82
|
+
|
83
|
+
|
84
|
+
def delete(*args, **kwargs):
|
85
|
+
return Session().delete(*args, **kwargs)
|
86
|
+
|
87
|
+
|
88
|
+
def get(*args, **kwargs):
|
89
|
+
return Session().get(*args, **kwargs)
|
90
|
+
|
91
|
+
|
92
|
+
def head(*args, **kwargs):
|
93
|
+
return Session().head(*args, **kwargs)
|
94
|
+
|
95
|
+
|
96
|
+
def options(*args, **kwargs):
|
97
|
+
return Session().options(*args, **kwargs)
|
98
|
+
|
99
|
+
|
100
|
+
def patch(*args, **kwargs):
|
101
|
+
return Session().patch(*args, **kwargs)
|
102
|
+
|
103
|
+
|
104
|
+
def post(*args, **kwargs):
|
105
|
+
return Session().post(*args, **kwargs)
|
106
|
+
|
107
|
+
|
108
|
+
def put(*args, **kwargs):
|
109
|
+
return Session().put(*args, **kwargs)
|
@@ -3,8 +3,22 @@ Tests to validate iripau.requests module
|
|
3
3
|
"""
|
4
4
|
|
5
5
|
import pytest
|
6
|
+
import mock
|
6
7
|
|
7
8
|
from iripau.requests import Session
|
9
|
+
from iripau.requests import delete
|
10
|
+
from iripau.requests import get
|
11
|
+
from iripau.requests import head
|
12
|
+
from iripau.requests import options
|
13
|
+
from iripau.requests import patch
|
14
|
+
from iripau.requests import post
|
15
|
+
from iripau.requests import put
|
16
|
+
|
17
|
+
URL = "https://some.url.com:8080/api"
|
18
|
+
KWARGS = {
|
19
|
+
"kwarg1": "Value-1",
|
20
|
+
"kwarg2": "Value-2"
|
21
|
+
}
|
8
22
|
|
9
23
|
|
10
24
|
class TestRequests:
|
@@ -70,3 +84,45 @@ class TestRequests:
|
|
70
84
|
|
71
85
|
assert response.request.headers["API-Key"] != "***"
|
72
86
|
assert response.request.headers["Authorization"] != "***"
|
87
|
+
|
88
|
+
@mock.patch("iripau.requests.Session")
|
89
|
+
def test_delete(self, mock_session):
|
90
|
+
response = delete(URL, **KWARGS)
|
91
|
+
mock_session.return_value.delete.assert_called_once_with(URL, **KWARGS)
|
92
|
+
assert mock_session.return_value.delete.return_value == response
|
93
|
+
|
94
|
+
@mock.patch("iripau.requests.Session")
|
95
|
+
def test_get(self, mock_session):
|
96
|
+
response = get(URL, **KWARGS)
|
97
|
+
mock_session.return_value.get.assert_called_once_with(URL, **KWARGS)
|
98
|
+
assert mock_session.return_value.get.return_value == response
|
99
|
+
|
100
|
+
@mock.patch("iripau.requests.Session")
|
101
|
+
def test_head(self, mock_session):
|
102
|
+
response = head(URL, **KWARGS)
|
103
|
+
mock_session.return_value.head.assert_called_once_with(URL, **KWARGS)
|
104
|
+
assert mock_session.return_value.head.return_value == response
|
105
|
+
|
106
|
+
@mock.patch("iripau.requests.Session")
|
107
|
+
def test_options(self, mock_session):
|
108
|
+
response = options(URL, **KWARGS)
|
109
|
+
mock_session.return_value.options.assert_called_once_with(URL, **KWARGS)
|
110
|
+
assert mock_session.return_value.options.return_value == response
|
111
|
+
|
112
|
+
@mock.patch("iripau.requests.Session")
|
113
|
+
def test_patch(self, mock_session):
|
114
|
+
response = patch(URL, **KWARGS)
|
115
|
+
mock_session.return_value.patch.assert_called_once_with(URL, **KWARGS)
|
116
|
+
assert mock_session.return_value.patch.return_value == response
|
117
|
+
|
118
|
+
@mock.patch("iripau.requests.Session")
|
119
|
+
def test_post(self, mock_session):
|
120
|
+
response = post(URL, **KWARGS)
|
121
|
+
mock_session.return_value.post.assert_called_once_with(URL, **KWARGS)
|
122
|
+
assert mock_session.return_value.post.return_value == response
|
123
|
+
|
124
|
+
@mock.patch("iripau.requests.Session")
|
125
|
+
def test_put(self, mock_session):
|
126
|
+
response = put(URL, **KWARGS)
|
127
|
+
mock_session.return_value.put.assert_called_once_with(URL, **KWARGS)
|
128
|
+
assert mock_session.return_value.put.return_value == response
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|