def update_cwe(): try: LOGGER.info('Updating cws, download file') file = get_file(CWE_MITRE_URL) if file: LOGGER.info('File downloaded for cwe year, parsing...') CWEFactory.process(file) file.close() LOGGER.info('CWE file parsing done.') else: LOGGER.info('Unable to download CWE file') except Exception as ex: LOGGER.error(ex)
def setUp(self): super().setUp() with open(get_fixture_location(__file__, 'cwec_v2.12.xml')) as handle: CWEFactory.process(handle) thread_pool_executor.wait_for_all()
def test_should_not_update(self): self.assertEqual(Search().index(CweDocument.Index.name).count(), 2) with open(get_fixture_location(__file__, 'cwec_v2.12.xml')) as handle: CWEFactory.process(handle) thread_pool_executor.wait_for_all() self.assertEqual(Search().index(CweDocument.Index.name).count(), 2)
def setUpClass(cls): super().setUpClass() with open(get_fixture_location(__file__, 'cwec_v2.12.xml')) as handle: CWEFactory.process(handle)