Пример #1
0
    async def register_analysis_module_type(
            self, amt: AnalysisModuleType) -> AnalysisModuleType:
        assert isinstance(amt, AnalysisModuleType)
        async with self.get_client() as client:
            response = await client.post("/amt", json=amt.to_dict())

        _raise_exception_on_error(response)
        return AnalysisModuleType.from_dict(response.json())
Пример #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())