mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-05 09:59:24 +00:00
Fix missing test coverage in fetcher.py.
This commit is contained in:
parent
9c8fb6f901
commit
b721e3c5f2
@ -1334,6 +1334,21 @@ class FakeNode(object):
|
||||
|
||||
|
||||
class Selection(unittest.TestCase):
|
||||
def test_failure(self):
|
||||
"""If the fetch loop fails, it tell the Node the fetch failed."""
|
||||
node = FakeNode()
|
||||
# Simulate a failure:
|
||||
node.get_num_segments = lambda: 1/0
|
||||
sf = SegmentFetcher(node, 0, 3, None)
|
||||
sf.add_shares([])
|
||||
d = flushEventualQueue()
|
||||
def _check1(ign):
|
||||
[_] = self.flushLoggedErrors(ZeroDivisionError)
|
||||
self.failUnless(node.failed)
|
||||
self.failUnless(node.failed.check(ZeroDivisionError))
|
||||
d.addCallback(_check1)
|
||||
return d
|
||||
|
||||
def test_no_shares(self):
|
||||
node = FakeNode()
|
||||
sf = SegmentFetcher(node, 0, 3, None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user