Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Valsecchi committed Jul 20, 2017
1 parent 3475458 commit cc14271
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 49 deletions.
57 changes: 17 additions & 40 deletions c2cwsgiutils/acceptance/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,39 @@ def get(self, url, expected_status=200, params=None, headers=None, cors=True, ca
"""
get the given URL (relative to the root of API).
"""
r = self.session.get(self.base_url + url, params=params, headers=self._merge_headers(headers, cors))
try:
with self.session.get(self.base_url + url, params=params,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed=cache_allowed)
self._check_cors(cors, r)
return r.text
finally:
r.close()

def get_raw(self, url, expected_status=200, params=None, headers=None, cors=True, cache_allowed=False):
"""
get the given URL (relative to the root of API).
"""
r = self.session.get(self.base_url + url, params=params, headers=self._merge_headers(headers, cors))
try:
with self.session.get(self.base_url + url, params=params,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed=cache_allowed)
self._check_cors(cors, r)
return r
finally:
r.close()

def get_json(self, url, expected_status=200, params=None, headers=None, cors=True, cache_allowed=False):
"""
get the given URL (relative to the root of API).
"""
r = self.session.get(self.base_url + url, params=params, headers=self._merge_headers(headers, cors))
try:
with self.session.get(self.base_url + url, params=params,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed=cache_allowed)
self._check_cors(cors, r)
return r.json()
finally:
r.close()

def get_xml(self, url, schema=None, expected_status=200, headers=None, params=None, cors=True,
cache_allowed=False):
"""
get the given URL (relative to the root of API).
"""
r = self.session.get(self.base_url + url, headers=self._merge_headers(headers, cors), params=params,
stream=True)
try:
with self.session.get(self.base_url + url, headers=self._merge_headers(headers, cors), params=params,
stream=True) as r:
check_response(r, expected_status, cache_allowed=cache_allowed)
self._check_cors(cors, r)
r.raw.decode_content = True
Expand All @@ -65,73 +58,57 @@ def get_xml(self, url, schema=None, expected_status=200, headers=None, params=No
xml_schema = etree.XMLSchema(etree.parse(schema_file))
xml_schema.assertValid(doc)
return doc
finally:
r.close()

def post_json(self, url, data=None, json=None, expected_status=200, headers=None, cors=True,
cache_allowed=False):
"""
POST the given URL (relative to the root of API).
"""
r = self.session.post(self.base_url + url, data=data, json=json,
headers=self._merge_headers(headers, cors))
try:
with self.session.post(self.base_url + url, data=data, json=json,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed=cache_allowed)
self._check_cors(cors, r)
return r.json()
finally:
r.close()

def post_files(self, url, data=None, files=None, expected_status=200, headers=None, cors=True,
cache_allowed=False):
"""
POST files to the the given URL (relative to the root of API).
"""
r = self.session.post(self.base_url + url, data=data, files=files,
headers=self._merge_headers(headers, cors))
try:
with self.session.post(self.base_url + url, data=data, files=files,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed)
self._check_cors(cors, r)
return r.json()
finally:
r.close()

def post(self, url, data=None, expected_status=200, headers=None, cors=True, cache_allowed=False):
"""
POST the given URL (relative to the root of API).
"""
r = self.session.post(self.base_url + url, headers=self._merge_headers(headers, cors),
data=data)
try:
with self.session.post(self.base_url + url, headers=self._merge_headers(headers, cors),
data=data) as r:
check_response(r, expected_status, cache_allowed)
self._check_cors(cors, r)
return r.text
finally:
r.close()

def put_json(self, url, json=None, expected_status=200, headers=None, cors=True, cache_allowed=False):
"""
POST the given URL (relative to the root of API).
"""
r = self.session.put(self.base_url + url, json=json, headers=self._merge_headers(headers, cors))
try:
with self.session.put(self.base_url + url, json=json,
headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed)
self._check_cors(cors, r)
return r.json()
finally:
r.close()

def delete(self, url, expected_status=204, headers=None, cors=True, cache_allowed=False):
"""
DELETE the given URL (relative to the root of API).
"""
r = self.session.delete(self.base_url + url, headers=self._merge_headers(headers, cors))
try:
with self.session.delete(self.base_url + url, headers=self._merge_headers(headers, cors)) as r:
check_response(r, expected_status, cache_allowed)
self._check_cors(cors, r)
return r
finally:
r.close()

def _cors_headers(self, cors):
if cors:
Expand Down
16 changes: 8 additions & 8 deletions rel_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
alembic==0.9.2
alembic==0.9.3
cee_syslog_handler==0.4.1
codacy-coverage==1.3.6
cornice==2.4.0
coverage==4.3.4
coverage==4.4.1
flake8==3.3.0
gunicorn==19.7.1
lxml==3.8.0
netifaces==0.10.6
psycopg2==2.7.1
pyramid==1.9
pyramid_tm==2.1
pytest==3.1.1
requests==2.17.3
SQLAlchemy==1.1.10
zope.interface==4.4.1
pyramid==1.9.1
pyramid_tm==2.2
pytest==3.1.3
requests==2.18.1
SQLAlchemy==1.1.11
zope.interface==4.4.2
zope.sqlalchemy==0.7.7
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages


VERSION = '0.16.3'
VERSION = '0.17.0'
HERE = os.path.abspath(os.path.dirname(__file__))
INSTALL_REQUIRES = open(os.path.join(HERE, 'rel_requirements.txt')).read().splitlines()

Expand Down

0 comments on commit cc14271

Please sign in to comment.