예제 #1
0
    def test_update_organization_settings(self):
        # Setup Expected Response
        name = "name3373707"
        enable_asset_discovery = False
        expected_response = {
            "name": name,
            "enable_asset_discovery": enable_asset_discovery,
        }
        expected_response = organization_settings_pb2.OrganizationSettings(
            **expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        patch = mock.patch("google.api_core.grpc_helpers.create_channel")
        with patch as create_channel:
            create_channel.return_value = channel
            client = securitycenter_v1beta1.SecurityCenterClient()

        # Setup Request
        organization_settings = {}

        response = client.update_organization_settings(organization_settings)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = securitycenter_service_pb2.UpdateOrganizationSettingsRequest(
            organization_settings=organization_settings)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
예제 #2
0
    def test_update_organization_settings(self):
        # Setup Expected Response
        name = 'name3373707'
        enable_asset_discovery = False
        expected_response = {
            'name': name,
            'enable_asset_discovery': enable_asset_discovery
        }
        expected_response = organization_settings_pb2.OrganizationSettings(
            **expected_response)

        # Mock the API response
        channel = ChannelStub(responses=[expected_response])
        client = securitycenter_v1beta1.SecurityCenterClient(channel=channel)

        # Setup Request
        organization_settings = {}

        response = client.update_organization_settings(organization_settings)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = securitycenter_service_pb2.UpdateOrganizationSettingsRequest(
            organization_settings=organization_settings)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request