Skip to content

Commit

Permalink
Merge pull request #31 from justin-hsieh/testing
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
justin-hsieh authored Feb 8, 2024
2 parents 13c79d4 + ac13b1d commit 96cbb2a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def calculate_most_points_post():
contest_list[contest]['position'], contest_list[contest]['stat'], OWNERS, year, week)
if contest_list[contest].get('single'):
points = get_highest_points(points)

result_dict['contest_results'] = order_positions_by_points(points)
result_dict['contest'] = contest
result_dict['week'] = week
Expand Down
Empty file removed fantasy_app/test_scores.py
Empty file.
22 changes: 21 additions & 1 deletion test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from app import app
import json

def test_hello1_route():
response = app.test_client().get('/')
Expand All @@ -10,4 +11,23 @@ def test_calculate_most_points_get():
response = app.test_client().get('/most_points_get')
json_response = response.get_json()
assert list(json_response.keys()) == ['contest', 'contest_results']
assert response.status_code == 200
assert response.status_code == 200

def test_calculate_most_points_post():
response = app.test_client().post('/most_points_post',
json={
"contest": "total_lb_tackles",
"week": 14,
"year": "2023"})
json_response = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_response == {'status':'200', 'data': 'OK'}

response = app.test_client().post('/most_points_post',
json={
"contest": "highest_single_starter_points",
"week": 8,
"year": "2022"})
json_response = json.loads(response.get_data(as_text=True))
assert response.status_code == 200
assert json_response == {'status':'200', 'data': 'OK'}

0 comments on commit 96cbb2a

Please sign in to comment.