mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
refactor: Remove Message.set_file() / dc_msg_set_file() and related code (#6558)
Now that we are deduplicating everywhere, we can get rid of some code. The old python bindings did not get an optional `name` parameter because they are deprecated anyway, but it would be easy to add it.
This commit is contained in:
@@ -118,7 +118,7 @@ class Message:
|
||||
mtype = ffi.NULL if mime_type is None else as_dc_charpointer(mime_type)
|
||||
if not os.path.exists(path):
|
||||
raise ValueError(f"path does not exist: {path!r}")
|
||||
lib.dc_msg_set_file(self._dc_msg, as_dc_charpointer(path), mtype)
|
||||
lib.dc_msg_set_file_and_deduplicate(self._dc_msg, as_dc_charpointer(path), ffi.NULL, mtype)
|
||||
|
||||
@props.with_doc
|
||||
def basename(self) -> str:
|
||||
|
||||
@@ -436,11 +436,11 @@ class TestOfflineChat:
|
||||
assert msg.id > 0
|
||||
assert msg.is_file()
|
||||
assert os.path.exists(msg.filename)
|
||||
assert msg.filename.endswith(msg.basename)
|
||||
assert msg.filename.endswith(".txt") == fn.endswith(".txt")
|
||||
assert msg.filemime == typeout
|
||||
msg2 = chat1.send_file(fp, typein)
|
||||
assert msg2 != msg
|
||||
assert msg2.filename != msg.filename
|
||||
assert msg2.filename == msg.filename
|
||||
|
||||
def test_create_contact(self, acfactory):
|
||||
ac1 = acfactory.get_pseudo_configured_account()
|
||||
|
||||
Reference in New Issue
Block a user