-
Notifications
You must be signed in to change notification settings - Fork 5
Lab Manager Promotion and test fixes #348
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
Merged
aniket132123
merged 19 commits into
LabConnect-RCOS:main
from
aniket132123:labconnect-backend-aniket
Dec 11, 2025
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
365cdea
Fixed 4 test cases
aniket132123 3c98e38
Merge branch 'LabConnect-RCOS:main' into labconnect-backend-aniket
aniket132123 63233e9
Fixed Test and Registration
aniket132123 fb97753
Merge branch 'labconnect-backend-aniket' of https://github.com/aniket…
aniket132123 1a5e7d5
start lab manager registration
aniket132123 c1db9d9
Changed registration
aniket132123 86ffdf4
Merge branch 'LabConnect-RCOS:main' into labconnect-backend-aniket
aniket132123 63053fb
basic test cases
aniket132123 7e740c7
Test fixes
aniket132123 dd30d97
added tests for lab manager promotion
aniket132123 e88935a
improve readability and consistency
aniket132123 303fbe8
Merge branch 'LabConnect-RCOS:main' into labconnect-backend-aniket
aniket132123 3161243
Remove bloat
aniket132123 2b09991
Testing fixes
aniket132123 0f993d2
add demotion feature
aniket132123 a6e3033
fix and update demote
aniket132123 36350fa
Merge branch 'LabConnect-RCOS:main' into labconnect-backend-aniket
aniket132123 8512156
Merge branch 'labconnect-backend-aniket' of https://github.com/aniket…
aniket132123 2009d36
Ruff lint changes
aniket132123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| import pytest | ||
| from flask import json | ||
| from flask.testing import FlaskClient | ||
| from flask_jwt_extended import create_access_token | ||
|
|
||
|
|
||
| def test_home_page(test_client: FlaskClient) -> None: | ||
|
|
@@ -19,25 +20,6 @@ def test_home_page(test_client: FlaskClient) -> None: | |
| assert {"Hello": "There"} == json.loads(response.data) | ||
|
|
||
|
|
||
| def test_discover_route(test_client: FlaskClient) -> None: | ||
| """ | ||
| GIVEN a Flask application configured for testing | ||
| WHEN the '/discover' page is requested (GET) | ||
| THEN check that the response is valid | ||
| """ | ||
| response = test_client.get("/discover") | ||
|
|
||
| assert response.status_code == 200 | ||
| # Uncomment and modify the following line with expected response data | ||
| # data = json.loads(response.data.decode("utf-8")) | ||
| # assert data["data"][0] == { | ||
| # "title": "Nelson", | ||
| # "major": "CS", | ||
| # "attributes": ["Competitive Pay", "Four Credits", "Three Credits"], | ||
| # "pay": 9000.0, | ||
| # } | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "input_id, expected_profile", | ||
| [ | ||
|
|
@@ -46,7 +28,8 @@ def test_discover_route(test_client: FlaskClient) -> None: | |
| { | ||
| "id": "cenzar", | ||
| "first_name": "Rafael", | ||
| "opportunities": [...], # Replace with expected opportunities data | ||
| "opportunities": ["opportunity1"], | ||
| # Replace with expected opportunities data | ||
| }, | ||
| ) | ||
| ], | ||
|
|
@@ -57,7 +40,19 @@ def test_profile_page(test_client: FlaskClient, input_id, expected_profile) -> N | |
| WHEN the '/profile/<user>' page is requested (GET) | ||
| THEN check that the response is valid | ||
| """ | ||
| response = test_client.get("/profile", json={"id": input_id}) | ||
| # login_response = test_client.post("/login", | ||
| # json={"username": "test_user", "password": "password123"}) | ||
| # login_data = json.loads(login_response.data) | ||
| with test_client.application.app_context(): | ||
| access_token = create_access_token(identity='[email protected]') | ||
|
|
||
| # response = test_client.get("/profile", json={"id": input_id}) | ||
| # Make the request with the JWT token | ||
| response = test_client.get( | ||
| "/profile", | ||
| json={"id": input_id}, | ||
| headers={'Authorization': f'Bearer {access_token}'} | ||
| ) | ||
|
|
||
| assert response.status_code == 200 | ||
|
|
||
|
|
@@ -108,7 +103,7 @@ def test_years_route(test_client: FlaskClient) -> None: | |
| response = test_client.get("/years") | ||
|
|
||
| assert response.status_code == 200 | ||
| assert [2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031] == json.loads(response.data) | ||
| assert [2025, 2026, 2027, 2028, 2029, 2030, 2031] == json.loads(response.data) | ||
|
|
||
|
|
||
| def test_professor_profile(test_client: FlaskClient) -> None: | ||
|
|
@@ -117,7 +112,7 @@ def test_professor_profile(test_client: FlaskClient) -> None: | |
| WHEN the '/getProfessorProfile/<id>' page is requested (GET) | ||
| THEN check that the response is valid | ||
| """ | ||
| response = test_client.get("/getProfessorProfile/1") | ||
| response = test_client.get("/staff/cenzar") | ||
|
|
||
| assert response.status_code == 200 | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.