0011-misc-fix-function-redefined-pylint-error-62099.patch
passerelle/apps/cmis/apps.py | ||
---|---|---|
21 | 21 |
'''Monkeypatch cmislib request module to log requests and responses.''' |
22 | 22 | |
23 | 23 |
from cmislib.atompub import binding |
24 |
from cmislib.net import RESTService |
|
24 |
from cmislib.net import RESTService as CMISRESTService
|
|
25 | 25 | |
26 |
class RESTService(RESTService): |
|
26 |
class RESTService(CMISRESTService):
|
|
27 | 27 |
def get(self, url, *args, **kwargs): |
28 | 28 |
logger = kwargs.pop('passerelle_logger') |
29 | 29 |
logger.debug('cmislib GET request to %s', url) |
tests/test_arpege_ecp.py | ||
---|---|---|
76 | 76 | |
77 | 77 | |
78 | 78 |
@mock.patch('passerelle.utils.Request.get') |
79 |
def test_check_status(mocked_get, connector): |
|
79 |
def test_check_status_error(mocked_get, connector):
|
|
80 | 80 |
hello_response = json.loads(FAKE_HELLO_RESPONSE) |
81 | 81 |
del hello_response['Data'] |
82 | 82 |
mocked_get.return_value = tests.utils.FakedResponse(content=json.dumps(hello_response), status_code=200) |
... | ... | |
208 | 208 |
resp = app.get(endpoint) |
209 | 209 |
result = resp.json |
210 | 210 |
assert result['err'] == 1 |
211 |
assert result['err_desc'] == 'No JSON content returned: content'
|
|
211 |
assert result['err_desc'] == "No JSON content returned: 'content'"
|
|
212 | 212 | |
213 | 213 | |
214 | 214 |
@mock.patch('passerelle.utils.Request.get') |
215 | 215 |
@mock.patch('passerelle.utils.Request.post') |
216 |
def test_get_user_forms_failure_no_json(mocked_post, mocked_get, app, connector):
|
|
216 |
def test_get_user_forms_failure_arpege_error(mocked_post, mocked_get, app, connector):
|
|
217 | 217 |
endpoint = reverse( |
218 | 218 |
'generic-endpoint', |
219 | 219 |
kwargs={ |
tests/test_jsonresponse.py | ||
---|---|---|
128 | 128 |
assert data == {'test': 'un test', 'err': 0} |
129 | 129 | |
130 | 130 |
@to_json() |
131 |
def test_func(req): |
|
131 |
def test_func2(req):
|
|
132 | 132 |
class CustomException(Exception): |
133 | 133 |
http_status = 200 |
134 | 134 | |
135 | 135 |
raise CustomException |
136 | 136 | |
137 |
result = test_func(req) |
|
137 |
result = test_func2(req)
|
|
138 | 138 |
data = json_loads(result.content) |
139 | 139 |
assert 'err_class' in data |
140 | 140 |
assert 'err' in data |
tests/test_orange.py | ||
---|---|---|
167 | 167 | |
168 | 168 |
# sender name not allowed |
169 | 169 |
@httmock.urlmatch(netloc=NETLOC) |
170 |
def mocked_response(url, request): |
|
170 |
def mocked_response2(url, request):
|
|
171 | 171 |
request_body = json.loads(force_text(request.body)) |
172 | 172 |
assert request_body['smsParam']['senderName'] == 'john' |
173 | 173 |
error_response = [ |
... | ... | |
182 | 182 |
orange.provide_sender = True |
183 | 183 |
orange.save() |
184 | 184 |
with pytest.raises(OrangeError, match='The given sender name is not allowed.'): |
185 |
with httmock.HTTMock(mocked_response): |
|
185 |
with httmock.HTTMock(mocked_response2):
|
|
186 | 186 |
orange.diffusion('my_token', 'gid2', PAYLOAD['to'], PAYLOAD['message'], PAYLOAD['from']) |
187 | 187 | |
188 | 188 | |
189 |
- |