Add mappings for some file types to Viewtype / MIME type

Namely: ppt, pptx, xls, heif, heic, avif, txt.
But use Viewtype::File for medias without uniform support on all platforms.
This commit is contained in:
Rafael Diniz
2022-12-07 16:20:45 +03:00
committed by iequidoo
parent 7082f9f882
commit 4e943d52e4
4 changed files with 24 additions and 10 deletions

2
python/tests/data/r Normal file
View File

@@ -0,0 +1,2 @@
hello

View File

@@ -450,24 +450,25 @@ class TestOfflineChat:
assert msg.filemime == "image/png"
@pytest.mark.parametrize(
"typein,typeout",
"fn,typein,typeout",
[
(None, "application/octet-stream"),
("text/plain", "text/plain"),
("image/png", "image/png"),
("r", None, "application/octet-stream"),
("r.txt", None, "text/plain"),
("r.txt", "text/plain", "text/plain"),
("r.txt", "image/png", "image/png"),
],
)
def test_message_file(self, ac1, chat1, data, lp, typein, typeout):
def test_message_file(self, ac1, chat1, data, lp, fn, typein, typeout):
lp.sec("sending file")
fn = data.get_path("r.txt")
msg = chat1.send_file(fn, typein)
fp = data.get_path(fn)
msg = chat1.send_file(fp, typein)
assert msg
assert msg.id > 0
assert msg.is_file()
assert os.path.exists(msg.filename)
assert msg.filename.endswith(msg.basename)
assert msg.filemime == typeout
msg2 = chat1.send_file(fn, typein)
msg2 = chat1.send_file(fp, typein)
assert msg2 != msg
assert msg2.filename != msg.filename