Skip to content
Snippets Groups Projects
Commit c2f649f6 authored by Frédéric Dalleau's avatar Frédéric Dalleau :sun_with_face:
Browse files

bluez/ubt: Use temporary filename in dun and pan tests


In dun and pan tests, a file is retrieve from http to verify connection,
it is saved at the location defined in variable path. But path do not
contain a file path. Instead it's a dbus object path in /net/connman
namespace. As such, it is not suitable for using as a filename and any
tentative to open this file will end with an "File Not Found" error.

Instead, create a temporary filename that will be automatically deleted.

Reviewed-by: default avatarPhilip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: default avatarPhilip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: default avatarPhilip Withnall <philip.withnall@collabora.co.uk>
Signed-off-by: default avatarFrédéric Dalleau <frederic.dalleau@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D4447
parent 015bc5db
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ import dbus
import dbus.service
import dbus.mainloop.glib
import sys
import tempfile
import time
import urllib.request
from optparse import OptionParser
......@@ -470,7 +471,7 @@ class PbapDeviceProfileTester(DeviceProfileTester):
"net.connman.Service")
service.Connect(timeout=60000)
url = urllib.request.urlopen("http://connman.net")
f = open(path, 'w')
f = tempfile.TemporaryFile('w')
f.write(url.read(1000000).decode('utf-8'))
f.close()
service.Disconnect(timeout=60000)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment