def __init__(self, host_address, session_factory, root_session): self._set_v3_session(host_address, session_factory, root_session) # authority clients authority_client_factory = AuthorityClientFactory(self.session) self.administration_client = ( authority_client_factory.create_administration_client() ) self.user_client = authority_client_factory.create_user_client() self.device_client = authority_client_factory.create_device_client() self.org_client = authority_client_factory.create_org_client() self.legal_hold_client = authority_client_factory.create_legal_hold_client() self.archive_client = authority_client_factory.create_archive_client() self.security_client = authority_client_factory.create_security_client() self.user_context = UserContext(self.administration_client) archive_locator_factory = StorageTokenProviderFactory( self.session, self.security_client, self.device_client ) self.storage_client_factory = _get_storage_client_factory( session_factory, archive_locator_factory ) archive_accessor_manager = ArchiveAccessorManager( self.archive_client, self.storage_client_factory ) microservice_client_factory = MicroserviceClientFactory( host_address, root_session, session_factory, self.user_context, self.user_client, ) # modules (feature sets that combine info from multiple clients) self.archive_module = archive_module.ArchiveModule( archive_accessor_manager, self.archive_client ) self.security_module = sec_module.SecurityModule( self.security_client, self.storage_client_factory, microservice_client_factory, ) self.detection_lists_module = detectionlists.DetectionListsModule( microservice_client_factory ) self.alerts_module = alerts.AlertsModule(microservice_client_factory)
def test_create_archive_client(self, mock_session): factory = AuthorityClientFactory(mock_session) client = factory.create_archive_client() assert type(client) == archive.ArchiveClient