def test_update_rules(self, mock_print: mock.MagicMock):
        """Verify which rules files were saved and deleted."""
        with mock.patch('subprocess.check_call', side_effect=self._mock_git_clone):
            clone_rules.clone_rules_from_github()

        # There should be one print statement for each repo.
        mock_print.assert_has_calls([mock.ANY] * len(clone_rules.REMOTE_RULE_SOURCES))

        expected_files = {
            'github.com/Neo23x0/signature-base.git/yara/cloned.yara',
            'github.com/YARA-Rules/rules.git/CVE_Rules/cloned.yara',
            'private/private.yara'
        }
        self.assertEqual(expected_files, set(compile_rules._find_yara_files()))
Beispiel #2
0
 def clone_rules() -> None:
     """Clone YARA rules from other open-source projects."""
     clone_rules.clone_rules_from_github()