diff --git a/tests/test_gui_share.py b/tests/test_gui_share.py index 846a5034..58c90977 100644 --- a/tests/test_gui_share.py +++ b/tests/test_gui_share.py @@ -83,13 +83,13 @@ class TestShare(GuiBaseTest): ), ) - tmp_file = tempfile.NamedTemporaryFile() - with open(tmp_file.name, "wb") as f: - f.write(r.content) + tmp_file = tempfile.NamedTemporaryFile("wb", delete=False) + tmp_file.write(r.content) + tmp_file.close() - zip = zipfile.ZipFile(tmp_file.name) + z = zipfile.ZipFile(tmp_file.name) QtTest.QTest.qWait(50) - self.assertEqual("onionshare", zip.read("test.txt").decode("utf-8")) + self.assertEqual("onionshare", z.read("test.txt").decode("utf-8")) QtTest.QTest.qWait(500) @@ -135,9 +135,8 @@ class TestShare(GuiBaseTest): ), ) - tmp_file = tempfile.NamedTemporaryFile() - with open(tmp_file.name, "wb") as f: - f.write(r.content) + tmp_file = tempfile.NamedTemporaryFile("wb") + tmp_file.write(r.content) with open(tmp_file.name, "r") as f: self.assertEqual("onionshare", f.read()) @@ -207,7 +206,10 @@ class TestShare(GuiBaseTest): QtTest.QTest.mouseRelease( tab.get_mode().server_status.server_button, QtCore.Qt.LeftButton ) - self.assertEqual(tab.get_mode().server_status.status, 0) + self.assertEqual( + tab.get_mode().server_status.status, + tab.get_mode().server_status.STATUS_STOPPED, + ) self.server_is_stopped(tab) self.web_server_is_stopped(tab)