Skip to content

Commit 95b52c6

Browse files
committed
Use text/javascript
MIME type `application/javascript` is obsolete and has long been replaced with `text/javascript`. Now using it where we input it (in tests). Also accounting for both in tests involving filesystem as tests can be run on a version of libmagic that returns the obsolete version.
1 parent 3349b83 commit 95b52c6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

tests/zim/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ def build_data(tmp_path, png_image):
6363
@pytest.fixture(scope="function")
6464
def counters():
6565
return {
66-
"application/javascript": 8,
6766
"text/html": 3,
6867
"application/warc-headers": 28364,
6968
"text/html;raw=true": 6336,

tests/zim/test_fs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ def test_make_zim_file_working(build_data, png_image):
8181
assert reader.entry_count == 8 # includes redirect
8282

8383
assert reader.get_item("style.css").mimetype == "text/css"
84-
assert reader.get_item("app.js").mimetype == "application/javascript"
84+
assert reader.get_item("app.js").mimetype in (
85+
"text/javascript",
86+
"application/javascript",
87+
)
8588
assert reader.get_suggestions_count("bienvenue") == 0
8689
assert reader.get_suggestions_count("coucou") == 1
8790
assert "welcome" in list(reader.get_suggestions("coucou"))

tests/zim/test_libkiwix.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@
1313

1414

1515
def test_geline_nodelim():
16-
string = "application/javascript=8;text/html=3;application/warc-headers=28364;"
16+
string = "text/javascript=8;text/html=3;application/warc-headers=28364;"
1717
ins = io.StringIO(string)
1818
assert getline(ins) == (True, string)
1919

2020

2121
def test_getline():
22-
ins = io.StringIO(
23-
"application/javascript=8;text/html=3;application/warc-headers=28364;"
24-
)
25-
assert getline(ins, ";") == (False, "application/javascript=8")
22+
ins = io.StringIO("text/javascript=8;text/html=3;application/warc-headers=28364;")
23+
assert getline(ins, ";") == (False, "text/javascript=8")
2624
assert getline(ins, ";") == (False, "text/html=3")
2725
assert getline(ins, ";") == (False, "application/warc-headers=28364")
2826
assert getline(ins, ";") == (True, "")
@@ -40,14 +38,13 @@ def test_getline():
4038
{"foo": 1, "text/html;raw=true": 50, "bar": 2},
4139
),
4240
(
43-
"application/javascript=8;text/html=3;application/warc-headers=28364;"
41+
"text/html=3;application/warc-headers=28364;"
4442
"text/html;raw=true=6336;text/css=47;text/javascript=98;image/png=968;"
4543
"image/webp=24;application/json=3694;image/gif=10274;image/jpeg=1582;"
4644
"font/woff2=25;text/plain=284;application/atom+xml=247;"
4745
"application/x-www-form-urlencoded=9;video/mp4=9;"
4846
"application/x-javascript=7;application/xml=1;image/svg+xml=5",
4947
{
50-
"application/javascript": 8,
5148
"text/html": 3,
5249
"application/warc-headers": 28364,
5350
"text/html;raw=true": 6336,

0 commit comments

Comments
 (0)