コード例 #1
0
    def test_ti_config_and_load(self):
        test_config1 = Path(_TEST_DATA).joinpath("msticpyconfig-askql.yaml")
        with custom_mp_config(test_config1):
            ti_settings = get_provider_settings()

            self.assertIsInstance(ti_settings, dict)
            self.assertGreaterEqual(1, len(ti_settings))

            # Try to load TIProviders - should throw a warning on
            # missing provider class
            as_byoti_prov = AzSTI(query_provider=qry_prov)
            ti_lookup = TILookup(primary_providers=[as_byoti_prov])

            # should have 2 succesfully loaded providers
            self.assertGreaterEqual(1, len(ti_lookup.loaded_providers))
            self.assertGreaterEqual(1, len(ti_lookup.provider_status))
コード例 #2
0
    def test_ti_config_and_load(self):
        config_path = Path(_TEST_DATA).parent.joinpath(
            "msticpyconfig-test.yaml")
        with custom_mp_config(self.config_path):
            with warnings.catch_warnings():
                # We want to ignore warnings from missing config
                warnings.simplefilter("ignore", category=UserWarning)
                ti_settings = get_provider_settings()

                self.assertIsInstance(ti_settings, dict)
                self.assertGreaterEqual(len(ti_settings), 4)

        # Try to load TIProviders - should throw a warning on
        # missing provider class

        with custom_mp_config(self.config_path):
            with self.assertWarns(UserWarning):
                ti_lookup = TILookup()

        # should have 2 succesfully loaded providers
        self.assertGreaterEqual(len(ti_lookup.loaded_providers), 3)
        self.assertGreaterEqual(len(ti_lookup.provider_status), 3)
コード例 #3
0
 def load_ti_lookup():
     test_config1 = Path(_TEST_DATA).joinpath("msticpyconfig-askql.yaml").resolve()
     with custom_mp_config(test_config1):
         as_byoti_prov = AzSTI(query_provider=qry_prov)
         return TILookup(primary_providers=[as_byoti_prov])
コード例 #4
0
ファイル: unit_test_lib.py プロジェクト: microsoft/msticnb
 def result_to_df(cls, ioc_lookup):
     """Redirect to original method."""
     return TILookup.result_to_df(ioc_lookup)
コード例 #5
0
 def load_ti_lookup(self):
     with custom_mp_config(self.config_path):
         with warnings.catch_warnings():
             # We want to ignore warnings from missing config
             warnings.simplefilter("ignore", category=UserWarning)
             return TILookup()