mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 23:26:43 +00:00
Make test match reality, and fix corresponding bug.
This commit is contained in:
parent
f1bd7c0b06
commit
9b6067dcd1
@ -14,6 +14,7 @@ import os
|
||||
from twisted.trial import unittest
|
||||
from twisted.internet import defer, error
|
||||
from six.moves import StringIO
|
||||
from six import ensure_str
|
||||
import mock
|
||||
from ..util import tor_provider
|
||||
from ..scripts import create_node, runner
|
||||
@ -185,7 +186,8 @@ class CreateOnion(unittest.TestCase):
|
||||
protocol)))
|
||||
txtorcon = mock.Mock()
|
||||
ehs = mock.Mock()
|
||||
ehs.private_key = b"privkey"
|
||||
# This appears to be a native string in the real txtorcon object...
|
||||
ehs.private_key = ensure_str("privkey")
|
||||
ehs.hostname = "ONION.onion"
|
||||
txtorcon.EphemeralHiddenService = mock.Mock(return_value=ehs)
|
||||
ehs.add_to_tor = mock.Mock(return_value=defer.succeed(None))
|
||||
|
@ -211,6 +211,8 @@ def create_config(reactor, cli_config):
|
||||
"tor_onion.privkey")
|
||||
privkeyfile = os.path.join(private_dir, "tor_onion.privkey")
|
||||
with open(privkeyfile, "wb") as f:
|
||||
if isinstance(privkey, str):
|
||||
privkey = privkey.encode("ascii")
|
||||
f.write(privkey)
|
||||
|
||||
# tahoe_config_tor: this is a dictionary of keys/values to add to the
|
||||
|
Loading…
Reference in New Issue
Block a user