Skip to content

Add tests for blog GET and POST routes #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file modified lib/__pycache__/util_datetime.cpython-36.pyc
Binary file not shown.
Binary file modified lib/__pycache__/util_sqlalchemy.cpython-36.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ WTForms-Alchemy==0.16.9
flask_ckeditor

pytz
pytest
requests
22 changes: 22 additions & 0 deletions test_blog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import requests

ENDPOINT = 'http://localhost:8000/'

def test_can_call_endpoint():
response = requests.get(ENDPOINT)
assert response.status_code == 200

def test_can_create_post():
payload = {
"title": "Post 3",
"body": "Body 3",
"taglist":"",
"visible": "y"
}
response = requests.post(ENDPOINT + "/add", json=payload)
assert response.status_code == 200


# def test_can_delete_post():