Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Commit

Permalink
build fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
bongi23 committed Nov 29, 2018
1 parent 0915ae7 commit af95a31
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
branch = True

# Files and folders to be omitted by the tests coverage
omit = *venv*, */tests/*
omit = *venv*, */tests/*, *errors.py*


[report]
Expand Down
21 changes: 11 additions & 10 deletions flaskapp/tests/test_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ def test_create_objective(client):
))
assert reply.status_code == 400

# test for create_objective logged in with wrong data
reply = tested_app.post('/create_objective', data=dict(
start_date="2018-07-04",
end_date="2018-07-05",
target_distance=22,
name="Test OK"
))
with requests_mock.mock() as m:
m.post(OBJECTIVESERVICE + '/objectives')
reply = tested_app.post('/create_objective', data=dict(
start_date="2018-07-04",
end_date="2018-07-05",
target_distance=22,
name="Test OK"
))
assert reply.status_code == 200


def test_view_objectives(client):
tested_app, app = client

Expand All @@ -79,10 +81,9 @@ def test_view_objectives(client):
# add the objective
obj = new_objective(name="Test1")


with requests_mock.mock() as m:
m.get(OBJECTIVESERVICE + 'objectives?user_id=1', json=obj.to_json())
reply = requests.get(OBJECTIVESERVICE + 'objectives?user_id=1')
m.get(OBJECTIVESERVICE + '/objectives?user_id=1', json=obj.to_json())
reply = requests.get(OBJECTIVESERVICE + '/objectives?user_id=1')
# assert tested_app.get('/objectives', follow_redirects=True).status_code == 200


Expand Down
2 changes: 1 addition & 1 deletion flaskapp/views/objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ def create_objective():
# Bad data were sent
status = 400

return render_template('create_objective.html', form=form), status
return render_template('create_objective.html', form=form), status

0 comments on commit af95a31

Please sign in to comment.