mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 04:57:54 +00:00
Try (but fail) to demonstrate the longname behavior
This commit is contained in:
parent
c6fc82665c
commit
c4c9d1389e
2
setup.py
2
setup.py
@ -111,7 +111,7 @@ install_requires = [
|
||||
"pyrsistent",
|
||||
|
||||
# A great way to define types of values.
|
||||
"attrs >= 18.2.0",
|
||||
"attrs >= 20.1.0",
|
||||
|
||||
# WebSocket library for twisted and asyncio
|
||||
"autobahn >= 22.4.3",
|
||||
|
@ -39,6 +39,7 @@ from os import urandom
|
||||
from configparser import NoSectionError
|
||||
|
||||
import attr
|
||||
from attr import define
|
||||
from hyperlink import DecodedURL
|
||||
from zope.interface import (
|
||||
Attribute,
|
||||
@ -637,6 +638,7 @@ class _FoolscapStorage(object):
|
||||
|
||||
|
||||
@implementer(IFoolscapStorageServer)
|
||||
@define
|
||||
class _NullStorage(object):
|
||||
"""
|
||||
Abstraction for *not* communicating with a storage server of a type with
|
||||
@ -650,7 +652,7 @@ class _NullStorage(object):
|
||||
lease_seed = hashlib.sha256(b"").digest()
|
||||
|
||||
name = "<unsupported>"
|
||||
longname = "<storage with unsupported protocol>"
|
||||
longname: str = "<storage with unsupported protocol>"
|
||||
|
||||
def connect_to(self, tub, got_connection):
|
||||
return NonReconnector()
|
||||
@ -784,9 +786,7 @@ def _make_storage_system(
|
||||
)
|
||||
except MissingPlugin as e:
|
||||
_log.failure("Missing plugin")
|
||||
ns = _NullStorage()
|
||||
ns.longname = '<missing plugin "{}">'.format(e.args[0])
|
||||
return ns
|
||||
return _NullStorage('<missing plugin "{}">'.format(e.args[0]))
|
||||
else:
|
||||
return _FoolscapStorage.from_announcement(
|
||||
server_id,
|
||||
|
@ -159,7 +159,7 @@ class GetConnectionStatus(unittest.TestCase):
|
||||
self.assertTrue(IConnectionStatus.providedBy(connection_status))
|
||||
|
||||
|
||||
class UnrecognizedAnnouncement(unittest.TestCase):
|
||||
class UnrecognizedAnnouncement(SyncTestCase):
|
||||
"""
|
||||
Tests for handling of announcements that aren't recognized and don't use
|
||||
*anonymous-storage-FURL*.
|
||||
@ -169,9 +169,14 @@ class UnrecognizedAnnouncement(unittest.TestCase):
|
||||
an announcement generated by a storage server plugin which is not loaded
|
||||
in the client.
|
||||
"""
|
||||
plugin_name = u"tahoe-lafs-testing-v1"
|
||||
ann = {
|
||||
u"name": u"tahoe-lafs-testing-v1",
|
||||
u"any-parameter": 12345,
|
||||
u"storage-options": [
|
||||
{
|
||||
u"name": plugin_name,
|
||||
u"any-parameter": 12345,
|
||||
},
|
||||
],
|
||||
}
|
||||
server_id = b"abc"
|
||||
|
||||
@ -234,6 +239,15 @@ class UnrecognizedAnnouncement(unittest.TestCase):
|
||||
server.get_foolscap_write_enabler_seed()
|
||||
server.get_nickname()
|
||||
|
||||
def test_longname(self) -> None:
|
||||
"""
|
||||
``NativeStorageServer.get_longname`` describes the missing plugin.
|
||||
"""
|
||||
server = self.native_storage_server()
|
||||
self.assertThat(
|
||||
server.get_longname(),
|
||||
Equals('<missing plugin "{}">'.format(self.plugin_name)),
|
||||
)
|
||||
|
||||
|
||||
class PluginMatchedAnnouncement(SyncTestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user