def from_local_account(cls, host_address, username, password): session_impl = Session session_factory = SessionFactory(session_impl, SessionModifierFactory(), AuthHandlerFactory()) basic_auth_session = session_factory.create_basic_auth_session( host_address, username, password) sdk_dependencies = SDKDependencies(host_address, session_factory, basic_auth_session) return cls(sdk_dependencies)
def from_local_account(cls, host_address, username, password): """Creates a :class:`~py42.sdk.SDKClient` object for accessing the Code42 REST APIs using the supplied credentials. Currently, only accounts created within the Code42 console or using the APIs (including py42) are supported. Username/passwords that are based on Active Directory, Okta, or other Identity providers cannot be used with this method. Args: host_address (str): The domain name of the Code42 instance being authenticated to, e.g. console.us.code42.com username (str): The username of the authenticating account. password (str): The password of the authenticating account. Returns: :class:`py42.sdk.SDKClient` """ session_impl = Session session_factory = SessionFactory(session_impl, SessionModifierFactory(), AuthHandlerFactory()) basic_auth_session = session_factory.create_basic_auth_session( host_address, username, password) sdk_dependencies = SDKDependencies(host_address, session_factory, basic_auth_session) return cls(sdk_dependencies)
def test_has_user_context_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.usercontext) == UserContext
def test_has_security_module_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.securitydata) == sec_mod.SecurityModule
def test_has_org_client_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.orgs) == orgs.OrgClient
def test_has_legal_hold_client_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.legalhold) == legalhold.LegalHoldClient
def test_has_detection_lists_module_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.detectionlists) == detectionlists.DetectionListsModule
def test_has_device_client_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.devices) == devices.DeviceClient
def test_has_archive_module_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.archive) == arch_mod.ArchiveModule
def test_has_administation_client_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.serveradmin) == administration.AdministrationClient
def test_has_alert_module_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.alerts) == alerts.AlertsModule
def test_has_storage_client_factory_set(self, mock_session_factory, success_requests_session): deps = SDKDependencies(HOST_ADDRESS, mock_session_factory, success_requests_session) sdk = SDKClient(deps) assert type(sdk.storageaccess) == StorageClientFactory