mirror of
https://github.com/shouptech/humulus.git
synced 2026-02-03 23:29:42 +00:00
Compare commits
No commits in common. "cc4ed2bef985b3914ca45529af0e622fa8296287" and "e1bb6184ab2392052ab7df01a92aa14a091273c4" have entirely different histories.
cc4ed2bef9
...
e1bb6184ab
6 changed files with 3 additions and 55 deletions
20
.drone.yml
20
.drone.yml
|
|
@ -1,29 +1,11 @@
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
services:
|
|
||||||
- name: couchdb
|
|
||||||
image: couchdb:2.3
|
|
||||||
environment:
|
|
||||||
COUCHDB_USER: admin
|
|
||||||
COUCHDB_PASSWORD: password
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: test
|
- test
|
||||||
image: python:3.6
|
image: python:3.6
|
||||||
environment:
|
|
||||||
COUCH_URL: 'http://couchdb:5984'
|
|
||||||
CODECOV_TOKEN:
|
|
||||||
from_secret: CODECOV_TOKEN
|
|
||||||
commands:
|
commands:
|
||||||
# Install pre-requisites
|
|
||||||
- pip install coverage pytest
|
- pip install coverage pytest
|
||||||
- pip install -e .
|
- pip install -e .
|
||||||
# Wait for couch
|
|
||||||
- until curl "$COUCH_URL" ; do sleep 1 ; done
|
|
||||||
# Run tests
|
|
||||||
- coverage run -m pytest
|
- coverage run -m pytest
|
||||||
- coverage report -m
|
- coverage report -m
|
||||||
# Upload coverage report
|
|
||||||
- pip install codecov
|
|
||||||
- codecov
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,3 @@
|
||||||
.. image:: https://drone.shoup.io/api/badges/shouptech/humulus/status.svg
|
|
||||||
:target: https://drone.shoup.io/shouptech/humulus
|
|
||||||
:alt: Drone build status
|
|
||||||
|
|
||||||
.. image:: https://codecov.io/gh/shouptech/humulus/branch/master/graph/badge.svg
|
|
||||||
:target: https://codecov.io/gh/shouptech/humulus
|
|
||||||
:alt: Code Coverage
|
|
||||||
|
|
||||||
Humulus is an open-source homebrew beer recipe app built using Flask.
|
Humulus is an open-source homebrew beer recipe app built using Flask.
|
||||||
|
|
||||||
Humulus is currently very much WIP and probably doesn't actually work.
|
Humulus is currently very much WIP and probably doesn't actually work.
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
@ -119,13 +118,3 @@ def get_doc_or_404(id):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
abort(404)
|
abort(404)
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
def put_doc_from_file(filename):
|
|
||||||
"""Loads filename and stores it in couch.
|
|
||||||
|
|
||||||
The file must be valid JSON.
|
|
||||||
"""
|
|
||||||
with open(filename, 'r') as doc:
|
|
||||||
response = put_doc(json.load(doc))
|
|
||||||
return response
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"_id": "testfile",
|
|
||||||
"foo": "bar"
|
|
||||||
}
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
@ -23,9 +22,8 @@ from humulus.couch import build_couch, get_couch, put_doc
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def app():
|
def app():
|
||||||
dbname = 'test_{}'.format(str(uuid.uuid4()))
|
dbname = 'test_{}'.format(str(uuid.uuid4()))
|
||||||
couchurl = os.environ.get('COUCH_URL', 'http://127.0.0.1:5984')
|
|
||||||
app = create_app({
|
app = create_app({
|
||||||
'COUCH_URL': couchurl,
|
'COUCH_URL': 'http://127.0.0.1:5984',
|
||||||
'COUCH_USERNAME': 'admin',
|
'COUCH_USERNAME': 'admin',
|
||||||
'COUCH_PASSWORD': 'password',
|
'COUCH_PASSWORD': 'password',
|
||||||
'COUCH_DATABASE': dbname,
|
'COUCH_DATABASE': dbname,
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import pathlib
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from humulus.couch import get_doc, put_doc, update_doc, put_doc_from_file
|
from humulus.couch import get_doc, put_doc, update_doc
|
||||||
|
|
||||||
|
|
||||||
def test_put_doc(app):
|
def test_put_doc(app):
|
||||||
|
|
@ -65,11 +64,3 @@ def test_build_couch_command(runner, monkeypatch):
|
||||||
def test_get_doc(app):
|
def test_get_doc(app):
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
assert get_doc('foobar')['data'] == 'test'
|
assert get_doc('foobar')['data'] == 'test'
|
||||||
|
|
||||||
|
|
||||||
def test_put_doc_from_file(app):
|
|
||||||
here = pathlib.Path(__file__).parent
|
|
||||||
with app.app_context():
|
|
||||||
response = put_doc_from_file(here/'assets'/'test_doc.json')
|
|
||||||
assert response['_id'] == 'testfile'
|
|
||||||
assert response['foo'] == 'bar'
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue