Add StorageStatus::renderSynchronously

Related to ticket:3247

test_storage.py wants a `StorageStatus::renderSynchronously()` method
and a `StorageStatus::renderHTTP()` method.  Let us begin with the
goofy first-cut.

Both these methods are not only wrong, but they will also not please
the test suite.  However error messages produced in CI can be shared,
and that way I can hopefully get unstuck.
This commit is contained in:
Sajith Sasidharan 2020-02-04 22:59:45 -05:00 committed by Sajith Sasidharan
parent aad3557d2b
commit 75488c4aff

View File

@ -1,7 +1,8 @@
import time, json
from twisted.python.filepath import FilePath
from twisted.web.template import tags as T, renderer, Element, renderElement, XMLFile
from twisted.web.template import tags as T, \
renderer, Element, renderElement, XMLFile
from allmydata.web.common import (
abbreviate_time,
MultiFormatResource
@ -303,3 +304,14 @@ class StorageStatus(MultiFormatResource):
"lease-checker-progress": self.storage.lease_checker.get_progress(),
}
return json.dumps(d, indent=1) + "\n"
def renderSynchronously(self):
# to appease the test suite.
elem = StorageStatusElement(self.storage, self.nickname)
result = []
flattenString(None, elem).addCallback(result.append)
return result
def renderHTTP(self, ctx=None):
# to appease the test suite.
self.renderSynchronously()