Skip to content
Merged
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
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
dist: xenial
language: python
python:
- "3.6"
- "3.7-dev"

install:
- pip3 install pipenv
- pipenv install --dev


script:
- pipenv run pytest -v --disable-pytest-warning
- pipenv run black --check ./
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ peewee = "*"
[dev-packages]
requests = "*"
pytest = "*"
webtest = "*"

[requires]
python_version = "3.6"
63 changes: 50 additions & 13 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion server.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def rankings():
]
return bottle.template("rankings.html", people=order)


def logggedIn():
if not bottle.request.get_cookie("s_id"):
return False
Expand Down Expand Up @@ -323,4 +324,5 @@ def error404(error):
return template("error.html", errorcode=error.status_code, errorbody=error.body)


bottle.run(app, host="localhost", port=8080)
if __name__ == "__main__":
bottle.run(app, host="localhost", port=8080)
28 changes: 0 additions & 28 deletions test_server.py

This file was deleted.

Empty file added tests/__init__.py
Empty file.
42 changes: 42 additions & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from server import app
from webtest import TestApp

# import requests

# url = 'http://localhost:8080'


def test_demo():
assert 1 == 1


@pytest.fixture(scope="module")
def application():
test_app = TestApp(app)
return test_app


def test_handlers(application):
handlers = ["/dashboard", "/home"]
for handler in handlers:
assert application.get(handler).status == "200 OK"


# def test_question():
# r = requests.get(url+'/question/1')
# assert r.status_code == 200

# def test_download():
# time = datetime.datetime.now()

# type(uploaded) == <class 'bytes'>
# uploaded outputs by user
# assert requests.get(url+'/question/1/inputs.txt').status_code == 200

# def test_file_upload():
# files= {'upload' : open('files/questions/1/output.txt', 'rb')}
# global url
# check_url = url + '/check/1'

# assert requests.post(check_url, files = files).status_code == 200