Replace .format with python 3.6 f-strings in tests

This commit is contained in:
Micah Lee 2019-10-20 10:46:14 -07:00
parent bbc14f5258
commit 58ad7907fd
8 changed files with 35 additions and 55 deletions

View file

@ -10,14 +10,12 @@ class TorGuiReceiveTest(TorGuiBaseTest):
(socks_address, socks_port) = self.gui.app.onion.get_tor_socks_port()
session = requests.session()
session.proxies = {}
session.proxies["http"] = "socks5h://{}:{}".format(socks_address, socks_port)
session.proxies["http"] = f"socks5h://{socks_address}:{socks_port}"
files = {"file[]": open(file_to_upload, "rb")}
if not public_mode:
path = "http://{}/{}/upload".format(
self.gui.app.onion_host, self.gui.receive_mode.web.password
)
path = f"http://{self.gui.app.onion_host}/{self.gui.receive_mode.web.password}/upload"
else:
path = "http://{}/upload".format(self.gui.app.onion_host)
path = f"http://{self.gui.app.onion_host}/upload"
response = session.post(path, files=files)
QtTest.QTest.qWait(4000)
self.assertTrue(os.path.isfile(expected_file))