Updating dependencies and tests

deb
androiddrew 7 years ago
parent 101698c348
commit 442b8acdc5

1
.gitignore vendored

@ -51,6 +51,7 @@ htmlcov/
nosetests.xml
coverage.xml
*,cover
.pytest_cache/
# Translations
*.mo

@ -28,6 +28,6 @@ The Cookie API serves as a simple experimentation application for testing concep
# Testing
```python
pip install -e . [testing]
py
pip install -e .[testing]
pytest
```

@ -15,7 +15,7 @@ logger = logbook.Logger(__name__)
def get_cookies(session: Session) -> typing.List[CookieSchema]:
cookies = session.query(Cookie).all()
logger.debug('Cookies collection hit')
return [CookieSchema(cookie) for cookie in cookies]
return MetaJSONResponse([CookieSchema(cookie) for cookie in cookies])
def get_cookie(session: Session, id) -> CookieSchema:

@ -1,5 +1,5 @@
from .app import MetaApp
from .http import MetaJSONResponse, ExtJSONResponse
from .component import SQLAlchemySession
from .component import SQLAlchemySession, DBSession
from .hook import SQLAlchemyHook
from .validators import Decimal

@ -41,6 +41,7 @@ class MetaJSONResponse(Response):
meta: typing.Any = None) -> None:
self.status_code = status_code
self.meta = self._build_meta(meta)
self._content = content
self.content = self.render(content)
self.headers = MutableHeaders(headers)
self.set_default_headers()

@ -1,10 +1,11 @@
alembic==0.9.9
apistar==0.5.12
apistar==0.5.18
apistar-jwt==0.4.2
bcrypt==3.1.4
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
click=6.7
idna==2.6
Jinja2==2.10
Logbook==1.3.3
@ -15,6 +16,7 @@ pycparser==2.18
PyJWT==1.6.1
python-dateutil==2.7.2
python-editor==1.0.3
pyyaml=3.12
requests==2.18.4
six==1.11.0
SQLAlchemy==1.2.7

@ -13,13 +13,13 @@ def test_get_cookies_empty(app):
client = TestClient(app)
response = client.get('/cookies')
assert response.status_code == 200
assert response.json() == []
assert response.json()['data'] == []
def test_get_empty_cookies(rb_session):
extended_response = get_cookies(rb_session)
assert extended_response.status_code == 200
assert json.dumps([], default=ExtJSONResponse.default).encode('utf-8') == extended_response.content
assert extended_response._content == []
def test_get_cookies(rb_session):
@ -32,7 +32,7 @@ def test_get_cookies(rb_session):
rb_session.flush()
cookies = rb_session.query(Cookie).all()
extended_response = get_cookies(rb_session)
assert len(extended_response.content) == 1
assert len(extended_response._content) == 1

@ -12,4 +12,4 @@ app = application_factory()
if __name__ == '__main__':
app = application_factory()
app.serve('127.0.0.1', 5000, debug=True)
app.serve('127.0.0.1', 8080, debug=True)

Loading…
Cancel
Save