예제 #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)