mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
22 lines
384 B
Python
22 lines
384 B
Python
import tempfile
|
|
|
|
class MockSubprocess():
|
|
def __init__(self):
|
|
self.last_call = None
|
|
|
|
def call(self, args):
|
|
self.last_call = args
|
|
|
|
def last_call_args(self):
|
|
return self.last_call
|
|
|
|
def write_tempfile(text):
|
|
tempdir = tempfile.mkdtemp()
|
|
path = tempdir + "/test-file.txt"
|
|
with open(path, "w") as f:
|
|
f.write(text)
|
|
f.close()
|
|
return path
|
|
|
|
|