mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
Update unit tests to support HTTPS storage protocol on by default.
This commit is contained in:
parent
0e72f3c97a
commit
aef6373915
@ -13,6 +13,7 @@ if PY2:
|
||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||
|
||||
import attr
|
||||
from hyperlink import DecodedURL
|
||||
|
||||
from testtools.matchers import (
|
||||
Mismatch,
|
||||
@ -95,6 +96,7 @@ def matches_storage_announcement(basedir, anonymous=True, options=None):
|
||||
}
|
||||
if anonymous:
|
||||
announcement[u"anonymous-storage-FURL"] = matches_furl()
|
||||
announcement[u"anonymous-storage-NURLs"] = matches_nurls()
|
||||
if options:
|
||||
announcement[u"storage-options"] = MatchesListwise(options)
|
||||
return MatchesStructure(
|
||||
@ -112,6 +114,16 @@ def matches_furl():
|
||||
return AfterPreprocessing(decode_furl, Always())
|
||||
|
||||
|
||||
def matches_nurls():
|
||||
"""
|
||||
Matches a sequence of NURLs.
|
||||
"""
|
||||
return AfterPreprocessing(
|
||||
lambda nurls: [DecodedURL.from_text(u) for u in nurls],
|
||||
Always()
|
||||
)
|
||||
|
||||
|
||||
def matches_base32():
|
||||
"""
|
||||
Match any base32 encoded byte string.
|
||||
|
@ -742,13 +742,14 @@ storage:
|
||||
self.assertTrue(done.called)
|
||||
|
||||
def test_should_we_use_http_default(self):
|
||||
"""Default is to not use HTTP; this will change eventually"""
|
||||
"""Default is to use HTTP; this will change eventually"""
|
||||
basedir = self.mktemp()
|
||||
node_config = config_from_string(basedir, "", "")
|
||||
announcement = {ANONYMOUS_STORAGE_NURLS: ["pb://..."]}
|
||||
self.assertFalse(
|
||||
self.assertTrue(
|
||||
StorageFarmBroker._should_we_use_http(node_config, announcement)
|
||||
)
|
||||
# Lacking NURLs, we can't use HTTP:
|
||||
self.assertFalse(
|
||||
StorageFarmBroker._should_we_use_http(node_config, {})
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user