Example #1
0
    async def i_track_analysis_module_type(self, amt: AnalysisModuleType):
        assert isinstance(amt, AnalysisModuleType)
        db_amt = AnalysisModuleTracking(name=amt.name, json_data=amt.to_json())

        async with self.get_db() as db:
            await db.merge(db_amt)
            await db.commit()
Example #2
0
def test_analysis_module_type_serialization():
    amt = AnalysisModuleType(
        name="test",
        description="test",
        observable_types=["test1", "test2"],
        directives=["test1", "test2"],
        dependencies=["test1", "test2"],
        tags=["test1", "test2"],
        modes=["test1", "test2"],
        cache_ttl=60,
        extended_version={"test1": "test2"},
        types=["test1", "test2"],
    )

    assert amt == AnalysisModuleType.from_dict(amt.to_dict())
    assert amt == AnalysisModuleType.from_json(amt.to_json())