mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-13 16:29:51 +00:00
Add a FakeServer class for testing
This commit is contained in:
parent
6322404b1e
commit
1ed722494c
@ -17,6 +17,7 @@ from twisted.web.template import flattenString
|
||||
from allmydata import check_results, uri
|
||||
from allmydata import uri as tahoe_uri
|
||||
from allmydata.interfaces import (
|
||||
IServer,
|
||||
ICheckResults,
|
||||
IDeepCheckResults,
|
||||
)
|
||||
@ -56,6 +57,19 @@ class TestRequest(object, Request):
|
||||
self.postpath = [b""]
|
||||
|
||||
|
||||
@implementer(IServer)
|
||||
class FakeServer(object):
|
||||
|
||||
def get_name(self):
|
||||
return "fake name"
|
||||
|
||||
def get_longname(self):
|
||||
return "fake longname"
|
||||
|
||||
def get_nickname(self):
|
||||
return "fake nickname"
|
||||
|
||||
|
||||
@implementer(ICheckResults)
|
||||
class FakeResults(object):
|
||||
|
||||
@ -78,7 +92,11 @@ class FakeResults(object):
|
||||
def get_summary(self):
|
||||
return "A fake summary"
|
||||
|
||||
def get_corrupt_shares(self):
|
||||
return (FakeServer(), None, None)
|
||||
|
||||
|
||||
# TODO: maybe use check_results.DeepCheckResults?
|
||||
@implementer(IDeepCheckResults)
|
||||
class FakeDeepCheckResults(object):
|
||||
|
||||
@ -106,6 +124,7 @@ class FakeDeepCheckResults(object):
|
||||
return [
|
||||
# TODO: fill this with:
|
||||
# (IServer, storage_index, sharenum)
|
||||
FakeResults().get_corrupt_shares(),
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user