From 067be2c565c535c2b51c2880337bda4990d77597 Mon Sep 17 00:00:00 2001 From: Justin Hsieh <41461549+justin-hsieh@users.noreply.github.com> Date: Tue, 6 Feb 2024 13:10:57 -0700 Subject: [PATCH] add tests for app.py --- app.py | 3 +++ fantasy_app/test_app.py | 3 --- fantasy_app/test_scores.py | 0 test_app.py | 13 +++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) delete mode 100644 fantasy_app/test_app.py create mode 100644 fantasy_app/test_scores.py create mode 100644 test_app.py diff --git a/app.py b/app.py index 1202030..1063ae1 100644 --- a/app.py +++ b/app.py @@ -32,6 +32,9 @@ def calculate_most_points_get(): result_dict = {} contest = 'total_lb_points' points = get_most_position_points(contest_list[contest]['position'], + contest_list[contest]['stat'], + OWNERS, + '2023', current_week() - 1) result_dict['contest_results'] = order_positions_by_points(points) result_dict['contest'] = contest diff --git a/fantasy_app/test_app.py b/fantasy_app/test_app.py deleted file mode 100644 index f99b04e..0000000 --- a/fantasy_app/test_app.py +++ /dev/null @@ -1,3 +0,0 @@ -import pytest -def test_addition(): - assert 1 + 2 == 3 \ No newline at end of file diff --git a/fantasy_app/test_scores.py b/fantasy_app/test_scores.py new file mode 100644 index 0000000..e69de29 diff --git a/test_app.py b/test_app.py new file mode 100644 index 0000000..c889f4e --- /dev/null +++ b/test_app.py @@ -0,0 +1,13 @@ +from app import app + +def test_hello1_route(): + response = app.test_client().get('/') + json_response = response.get_json() + assert json_response == 'This is working' + assert response.status_code == 200 + +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 \ No newline at end of file