-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
89 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: python | ||
python: 3.6 | ||
branches: | ||
only: | ||
- master | ||
- "/^(release\\/)?v([1-9]\\d*!)?(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))*((a|b|rc)(0|[1-9]\\d*))?(\\.post(0|[1-9]\\d*))?(\\.dev(0|[1-9]\\d*))?$/" | ||
services: | ||
- postgresql | ||
before_install: make ci | ||
install: make install | ||
script: make cover | ||
after_success: coveralls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# fittonia | ||
|
||
[![Build Status](https://travis-ci.org/pylover/fittonia.svg?branch=master)](https://travis-ci.org/pylover/fittonia) | ||
[![Coverage Status](https://coveralls.io/repos/github/pylover/fittonia/badge.svg?branch=master)](https://coveralls.io/github/pylover/fittonia?branch=master) | ||
|
||
|
||
Store, Update and get JSON document using URL. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-r requirements-test.txt | ||
coveralls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-r requirements-test.txt | ||
gunicorn | ||
pytest-pudb | ||
ipython | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bddrest | ||
pytest-cov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
|
||
|
||
dependencies = [ | ||
'yhttp-pony >= 1, < 2', | ||
'yhttp-pony >= 1.1.1, < 2', | ||
'yhttp-auth >= 1.1, < 2', | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
import pytest | ||
import functools | ||
|
||
import fittonia | ||
import pytest | ||
import bddrest | ||
from yhttp.extensions.pony.testing import freshdb | ||
|
||
|
||
@pytest.fixture | ||
def app(): | ||
dbname = 'fittonia_test' | ||
fittonia.app.settings.merge(f''' | ||
db: | ||
url: postgres://postgres:postgres@localhost/{dbname} | ||
''') | ||
from fittonia import app | ||
return app | ||
|
||
|
||
@pytest.fixture | ||
def story(app): | ||
return functools.partial(bddrest.Given, app) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from bddrest import when, status, response | ||
from pony.orm import db_session as dbsession | ||
|
||
from fittonia import Resource | ||
|
||
|
||
def test_usercontent(app, story, freshdb): | ||
app.settings.merge(f''' | ||
db: | ||
url: {freshdb} | ||
''') | ||
|
||
@dbsession | ||
def mockup(): | ||
Resource(path='/users/foo', author='foo', content=dict(foo='bar')) | ||
|
||
app.ready() | ||
mockup() | ||
|
||
with story('Get a user content by anonymous user', '/users/foo'): | ||
print(response.text) | ||
assert status == 200 | ||
assert response.json == {'foo': 'bar'} | ||
|
||
when('Try to update a user content by anonymous', verb='POST', form={ | ||
'foo': 'baz' | ||
}) | ||
assert status == 401 | ||
|