def test_get_addon_main_file(self): dataset = DataSet() addon_path = os.path.join(self.dir_path, "renamed-wp-content", "plugins", "w3-total-cache") self.cms.get_addon_main_file(dataset.addon_wp_stage0, addon_path) self.assertEqual(dataset.addon_wp_stage0.filename, "w3-total-cache.php")
def test_get_addon_last_version(self): dataset = DataSet() self.cms.get_addon_last_version(dataset.addon_wp_stage2) self.assertEqual(dataset.addon_wp_stage2.last_version, "0.9.7.5") self.assertEqual(dataset.addon_wp_stage2.last_release_date, "2019-06-05") self.assertEqual(dataset.addon_wp_stage2.link, "https://wordpress.org/plugins/w3-total-cache/")
def test_get_addon_version(self): regex = re.compile("(?i)Version: (.*)") dataset = DataSet() addons_path = os.path.join(self.dir_path, "renamed-wp-content", "plugins", "w3-total-cache") self.cms.get_addon_version(dataset.addon_wp_stage1, addons_path, regex, " ") self.assertEqual(dataset.addon_wp_stage1.version, "0.9.4.1")
def setUp(self): report_name = "test-data-set/test.xlsx" self.report = rCMS.ComissionXLSX(report_name) dataset = DataSet() self.report.add_data(dataset.core, dataset.plugins, dataset.themes) self.report.generate_xlsx() self.workbook = load_workbook(report_name)
def test_get_addon_last_version(self): dataset = DataSet() self.cms.get_addon_last_version(dataset.addon_dpl_stage2) self.assertEqual("7.x-3.8", dataset.addon_dpl_stage2.last_version) self.assertEqual("14 February 2019", dataset.addon_dpl_stage2.last_release_date) self.assertEqual( dataset.addon_dpl_stage2.link, "https://www.drupal.org/project/media_youtube/releases")
def test_get_addon_version(self): regex = re.compile("version = (.*)") dataset = DataSet() addons_path = os.path.join(self.dir_path, "sites", "all", "modules", "xmlsitemap") self.cms.get_addon_version(dataset.addon_dpl_stage1, addons_path, regex, '"') self.assertEqual(dataset.addon_dpl_stage1.version, "7.x-2.3")
def test_check_addon_alteration(self): dataset = DataSet() temp_directory = uCMS.TempDir.create() self.cms.wp_content = "renamed-wp-content" self.cms.check_addon_alteration(dataset.addon_wp_stage2, self.dir_path, temp_directory) uCMS.TempDir.delete_all() altered_files = [] for alteration in dataset.addon_wp_stage2.alterations: altered_files.append(alteration.file) self.assertIn("readme.txt", altered_files)
def test_check_addon_alteration(self): dataset = DataSet() temp_directory = uCMS.TempDir.create() addon_path = os.path.join(self.dir_path, Path("sites"), Path("all"), Path("modules"), Path(dataset.addon_dpl_stage2.name)) self.cms.check_addon_alteration(dataset.addon_dpl_stage2, addon_path, temp_directory) uCMS.TempDir.delete_all() altered_files = [] for alteration in dataset.addon_dpl_stage2.alterations: altered_files.append(alteration.file) self.assertIn("media_youtube.test", altered_files)
def test_add_data(self): dataset = DataSet() self.report.add_data(dataset.core, dataset.plugins, dataset.themes) self.assertEqual(self.report.data["core"].version, "4.5.1")
def test_check_vulns_addon(self): dataset = DataSet() config = uCMS.parse_conf("test-data-set/test.conf") self.cms.wpvulndb_token = config["wpvulndb_token"] vulns_details = self.cms.check_vulns_addon(dataset.addon_wp_stage2) self.assertEqual(len(vulns_details), 11)
def test_generate_json(self): dataset = DataSet() self.report.add_data(dataset.core, dataset.plugins, dataset.themes) self.report.generate_json()
def test_add_data(self): dataset = DataSet() self.report.add_data(dataset.core, dataset.plugins, dataset.themes)
def setUp(self): self.report_name = "test-data-set/test.xlsx" self.report = ComissionXLSX(self.report_name) self.dataset = DataSet()