fix tests

This commit is contained in:
Victor Shyba 2020-02-17 17:47:07 -03:00
parent 7d872c7863
commit 237a8965eb
2 changed files with 10 additions and 8 deletions

View file

@ -122,6 +122,10 @@ async def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
class TestStreamManager(BlobExchangeTestBase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.client_config.share_usage_data = True
async def setup_stream_manager(self, balance=10.0, fee=None, old_sort=False):
file_path = os.path.join(self.server_dir, "test_file")
with open(file_path, 'wb') as f:

View file

@ -80,27 +80,25 @@ class CLILoggingTest(AsyncioTestCase):
self.assertFalse(log.getChild("torba").isEnabledFor(logging.DEBUG))
async def test_loggly(self):
async with get_logger(["start"], share_usage_data=False) as log:
async with get_logger(["start"]) as log: # default share_usage_data=False
self.assertEqual(len(log.getChild("lbry").handlers), 2) # file and console
async with get_logger(["start"]) as log: # default share_usage_data=True
async with get_logger(["start"], share_usage_data=True) as log:
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 3)
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
async with get_logger(["start"], share_usage_data=True) as log: # explicit share_usage_data=True
async with get_logger(["start"], share_usage_data=False) as log: # explicit share_usage_data=False
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 3)
self.assertIsInstance(log.handlers[2], HTTPSLogglyHandler)
self.assertEqual(len(log.handlers), 2)
async def test_quiet(self):
async with get_logger(["start"]) as log: # default is loud
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 3)
self.assertEqual(len(log.handlers), 2)
self.assertIs(type(log.handlers[1]), logging.StreamHandler)
async with get_logger(["start", "--quiet"]) as log:
log = log.getChild("lbry")
self.assertEqual(len(log.handlers), 2)
self.assertEqual(len(log.handlers), 1)
self.assertIsNot(type(log.handlers[0]), logging.StreamHandler)
self.assertIsNot(type(log.handlers[1]), logging.StreamHandler)
class CLITest(AsyncioTestCase):