-
Notifications
You must be signed in to change notification settings - Fork 144
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
1 parent
84d03a3
commit 9fde5e1
Showing
2 changed files
with
34 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from __future__ import annotations | ||
|
||
from whitenoise.media_types import MediaTypes | ||
|
||
|
||
def test_matched_filename(): | ||
result = MediaTypes().get_type("static/apple-app-site-association") | ||
assert result == "application/pkc7-mime" | ||
|
||
|
||
def test_matched_filename_cased(): | ||
result = MediaTypes().get_type("static/Apple-App-Site-Association") | ||
assert result == "application/pkc7-mime" | ||
|
||
|
||
def test_matched_extension(): | ||
result = MediaTypes().get_type("static/app.js") | ||
assert result == "text/javascript" | ||
|
||
|
||
def test_unmatched_extension(): | ||
result = MediaTypes().get_type("static/app.example-unmatched") | ||
assert result == "application/octet-stream" | ||
|
||
|
||
def test_extra_types(): | ||
types = MediaTypes(extra_types={".js": "application/javascript"}) | ||
result = types.get_type("static/app.js") | ||
assert result == "application/javascript" |
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