示例#1
0
文件: tasks.py 项目: muchrons/vmc
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)
示例#2
0
 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()
示例#3
0
 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)
示例#4
0
 def setUpClass(cls):
     super().setUpClass()
     with open(get_fixture_location(__file__, 'cwec_v2.12.xml')) as handle:
         CWEFactory.process(handle)