Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@log_capture()
def test_2(self, lc):
"""
Configure and activate a single :class:`~pywbem.WBEMConnection` object
logger for output of summary information for both "pywbem.api" and
"pywbem.http"::
Differs from example in that we set detail_level to limit output for
test
"""
namespace = 'root/blah'
conn = self.build_repo(namespace)
configure_logger('all', log_dest='file',
log_filename=TEST_OUTPUT_LOG,
detail_level=10,
connection=conn, propagate=True)
conn.GetClass('CIM_ObjectManager', namespace=namespace)
@log_capture()
def test_return_rule_for_no_users(self, l):
self.assertEquals(dt.parse_yaml(path=yt.ivYMLTest139, job_conf_path=job_conf_path, test=True), yt.iv139dict)
l.check_present(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', "Couldn't find a list under 'users:'! Ignoring rule."),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Finished config validation.')
)
@log_capture()
def test_download_cache2(self, capture):
cfg = WDL.runtime.config.Loader(logging.getLogger(self.id()))
cfg.override({
"download_cache": {
"put": True,
"get": True,
"dir": os.path.join(self._dir, "cache2"),
"enable_patterns": ["https://raw.githubusercontent.com/chanzuckerberg/*"]
}
})
inp = {"files": ["https://google.com/robots.txt", "https://raw.githubusercontent.com/chanzuckerberg/miniwdl/main/tests/alyssa_ben.txt"]}
self._run(self.count_wdl, inp, cfg=cfg)
self._run(self.count_wdl, inp, cfg=cfg)
logs = [str(record.msg) for record in capture.records if str(record.msg).startswith("downloaded input files")]
self.assertTrue("downloaded: 2" in logs[0])
# alyssa_ben.txt is cached on second run through
@log_capture(level=logging.INFO)
def do_some_logs(self, l):
levels = [0, 10, 20, 30, 40, 50, BRAKE_LEVEL]
for level in levels:
self.logger.log(level, "Hello.")
return l
@log_capture()
def test_item_lookup_10_products(self, product_api_init, product_api_lookup, lc):
"""
Tests for parsing 10 products.
:param product_api_init: mockup for ProductAdvertisingAPI.__init__
:type product_api_init: unittest.mock.MagicMock
:param product_api_lookup: mockup for ProductAdvertisingAPI.lookup_at_amazon
:type product_api_lookup: unittest.mock.MagicMock
:param lc: log capture instance
:type lc: testfixtures.logcapture.LogCaptureForDecorator
"""
product_api_init.return_value = None
product_api_lookup.return_value = self.__get_product_bs(product_sample_10_products)
api = ProductAdvertisingAPI()
values = api.item_lookup([
'DEMOASIN06',
@log_capture()
def test_return_rule_for_multiple_jobs(self, l):
self.assertEquals(dt.parse_yaml(path=yt.ivYMLTest133, job_conf_path=job_conf_path, test=True), yt.iv133dict)
l.check_present(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', "Missing a fail_message for rule 1 in 'smalt'. Adding generic fail_message."),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Finished config validation.')
)
@log_capture()
def test_item_lookup_no_audience_rating_isbn(self, product_api_init, product_api_lookup, lc):
"""
Test for a book without audience rating.
:param product_api_init: mockup for ProductAdvertisingAPI.__init__
:type product_api_init: unittest.mock.MagicMock
:param product_api_lookup: mockup for ProductAdvertisingAPI.lookup_at_amazon
:type product_api_lookup: unittest.mock.MagicMock
:param lc: log capture instance
:type lc: testfixtures.logcapture.LogCaptureForDecorator
"""
product_api_init.return_value = None
product_api_lookup.return_value = self.__get_product_bs(product_sample_no_audience_rating)
api = ProductAdvertisingAPI()
values = api.item_lookup(['123456789X'])