예제 #1
0
 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)
예제 #2
0
    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)
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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
예제 #10
0
 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
예제 #11
0
 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
예제 #12
0
파일: test_sdk.py 프로젝트: amoravec/py42
 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