-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
966 additions
and
705 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
python 3.12.0 | ||
python 3.12.4 |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 |
---|---|---|
@@ -1,72 +1,38 @@ | ||
from pathlib import Path | ||
|
||
from starlette.testclient import TestClient | ||
from fastapi.testclient import TestClient | ||
|
||
from src.main import app | ||
|
||
client = TestClient(app) | ||
|
||
base_path = Path.cwd() / "test_rosters" | ||
zipped_roster = str(base_path / "zipped_rosters" / "elite_roster.rosz") | ||
test_roster = str(base_path / "horus_heresy" / "hhv2.nightlords_zm.ros") | ||
|
||
SUCCESS: int = 200 | ||
|
||
|
||
def test__read_main(): | ||
response = client.get("/") | ||
assert response.status_code == SUCCESS | ||
|
||
|
||
def test__upload_roster(): | ||
multiple_pages = False | ||
summary_page = False | ||
use_icons = False | ||
def post_files(multiple_pages, summary_page, use_icons): | ||
with Path.open(test_roster) as roster_file: | ||
roster_file_text = roster_file.read() | ||
|
||
response = client.post( | ||
return client.post( | ||
"/files/", | ||
files={"file": roster_file_text}, | ||
data={"multiple_pages": multiple_pages, "summary_page": summary_page, "use_icons": use_icons}, | ||
) | ||
|
||
assert response.status_code == SUCCESS | ||
|
||
|
||
def test__upload_roster_multipart_false(): | ||
multiple_pages = False | ||
summary_page = False | ||
use_icons = False | ||
with Path.open(test_roster) as roster_file: | ||
roster_file_text = roster_file.read() | ||
|
||
response = client.post( | ||
"/files/", | ||
files={"file": roster_file_text}, | ||
data={"multiple_pages": multiple_pages, "summary_page": summary_page, "use_icons": use_icons}, | ||
) | ||
multiple_pages_response = "single_page.css" in response.text | ||
|
||
assert response.status_code == SUCCESS | ||
assert multiple_pages_response | ||
def test__read_main(): | ||
assert client.get("/").status_code == 200 | ||
|
||
|
||
def test__upload_roster_multipart_true(): | ||
multiple_pages = True | ||
summary_page = False | ||
use_icons = False | ||
def test__upload_roster(): | ||
assert post_files(False, False, False).status_code == 200 | ||
|
||
with Path.open(test_roster) as roster_file: | ||
roster_file_text = roster_file.read() | ||
|
||
response = client.post( | ||
"/files/", | ||
files={"file": roster_file_text}, | ||
data={"multiple_pages": multiple_pages, "summary_page": summary_page, "use_icons": use_icons}, | ||
) | ||
def test__upload_roster_multipart_false(): | ||
response = post_files(False, False, False) | ||
assert response.status_code == 200 | ||
assert "single_page.css" in response.text | ||
|
||
multiple_pages_response = "multiple_pages.css" in response.text | ||
|
||
assert response.status_code == SUCCESS | ||
assert multiple_pages_response | ||
def test__upload_roster_multipart_true(): | ||
assert post_files(True, False, False).status_code == 200 |
Oops, something went wrong.