Philipp Hörist pushed to branch soup3 at gajim / python-nbxmpp
Commits:
5399e2ca by Philipp Hörist at 2022-12-12T22:11:58+01:00
fix: Create Temp File
- - - - -
2 changed files:
- nbxmpp/http.py
- test/unit/test_http.py
Changes:
=====================================
nbxmpp/http.py
=====================================
@@ -189,7 +189,7 @@ class HTTPRequest(GObject.GObject):
self._request_content_type = content_type
self._request_content_length = len(data)
- def set_response_body_path(self, path: Path) -> None:
+ def set_response_body_from_path(self, path: Path) -> None:
self._response_body_file = Gio.File.new_for_path(str(path))
def connect(self,
=====================================
test/unit/test_http.py
=====================================
@@ -1,4 +1,5 @@
from time import time
+import tempfile
import unittest
from unittest.mock import call
from unittest.mock import Mock
@@ -37,7 +38,7 @@ class HTTP(unittest.TestCase):
def tearDownClass(cls):
pass
- def test_in_memory_download_to_file(self):
+ def test_download_to_file(self):
mainloop = GLib.MainLoop()
@@ -46,8 +47,8 @@ class HTTP(unittest.TestCase):
callback_mock = Mock()
- request.set_response_body_path(
- Path('/home/lovetox/Downloads/test123'))
+ temp_dir = tempfile.gettempdir()
+ request.set_response_body_from_path(Path(temp_dir) / 'file')
request.connect('response-progress', callback_mock.progress)
request.connect('starting-response-body', callback_mock.starting)
request.connect('finished', callback_mock.finished)
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/5399e2cae39586f380d83286fbb540b8d9ec3d16
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/5399e2cae39586f380d83286fbb540b8d9ec3d16
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits