mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-14 06:06:40 +00:00
basic positive path test
This commit is contained in:
parent
09acde41b9
commit
f3218e6f62
@ -19,6 +19,7 @@ from foolscap.api import (
|
||||
|
||||
from allmydata.interfaces import (
|
||||
IFoolscapStoragePlugin,
|
||||
IStorageServer,
|
||||
)
|
||||
from allmydata.client import (
|
||||
AnnounceableStorageServer,
|
||||
@ -56,7 +57,7 @@ class DummyStorage(object):
|
||||
|
||||
|
||||
def get_storage_client(self, configuration, announcement):
|
||||
pass
|
||||
return DummyStorageClient()
|
||||
|
||||
|
||||
|
||||
@ -68,3 +69,9 @@ class DummyStorageServer(object):
|
||||
|
||||
def remote_just_some_method(self):
|
||||
pass
|
||||
|
||||
|
||||
@implementer(IStorageServer)
|
||||
@attr.s
|
||||
class DummyStorageClient(object):
|
||||
pass
|
||||
|
@ -24,6 +24,9 @@ from .common import (
|
||||
UseTestPlugins,
|
||||
MemoryIntroducerClient,
|
||||
)
|
||||
from .storage_plugin import (
|
||||
DummyStorageClient,
|
||||
)
|
||||
from allmydata.util import base32, yamlutil
|
||||
from allmydata.client import (
|
||||
config_from_string,
|
||||
@ -227,6 +230,20 @@ storage.plugins = tahoe-lafs-dummy-v1
|
||||
storage = self.get_storage(server_id, self.node)
|
||||
self.assertIsInstance(storage, _NullStorage)
|
||||
|
||||
def test_enabled_plugin(self):
|
||||
"""
|
||||
An announcement that could be matched by a plugin that is enabled is
|
||||
matched and the plugin's storage client is used.
|
||||
"""
|
||||
server_id = b"v0-abcdef"
|
||||
ann = {
|
||||
u"service-name": u"storage",
|
||||
u"name": u"tahoe-lafs-dummy-v1",
|
||||
}
|
||||
self.publish(server_id, ann)
|
||||
storage = self.get_storage(server_id, self.node)
|
||||
self.assertIsInstance(storage, DummyStorageClient)
|
||||
|
||||
|
||||
class TestStorageFarmBroker(unittest.TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user