def test_update_uptime_check_config(self):
        # Setup Expected Response
        name = "name3373707"
        display_name = "displayName1615086568"
        is_internal = True
        expected_response = {
            "name": name,
            "display_name": display_name,
            "is_internal": is_internal,
        }
        expected_response = uptime_pb2.UptimeCheckConfig(**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 = monitoring_v3.UptimeCheckServiceClient()

        # Setup Request
        uptime_check_config = {}

        response = client.update_uptime_check_config(uptime_check_config)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.UpdateUptimeCheckConfigRequest(
            uptime_check_config=uptime_check_config)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_get_uptime_check_config(self):
        # Setup Expected Response
        name_2 = "name2-1052831874"
        display_name = "displayName1615086568"
        is_internal = True
        expected_response = {
            "name": name_2,
            "display_name": display_name,
            "is_internal": is_internal,
        }
        expected_response = uptime_pb2.UptimeCheckConfig(**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 = monitoring_v3.UptimeCheckServiceClient()

        # Setup Request
        name = client.uptime_check_config_path("[PROJECT]",
                                               "[UPTIME_CHECK_CONFIG]")

        response = client.get_uptime_check_config(name)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.GetUptimeCheckConfigRequest(
            name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
Exemple #3
0
    def test_create_uptime_check_config(self):
        # Setup Expected Response
        name = 'name3373707'
        display_name = 'displayName1615086568'
        is_internal = True
        expected_response = {
            'name': name,
            'display_name': display_name,
            'is_internal': is_internal
        }
        expected_response = uptime_pb2.UptimeCheckConfig(**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 = monitoring_v3.UptimeCheckServiceClient()

        # Setup Request
        parent = client.project_path('[PROJECT]')
        uptime_check_config = {}

        response = client.create_uptime_check_config(parent,
                                                     uptime_check_config)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.CreateUptimeCheckConfigRequest(
            parent=parent, uptime_check_config=uptime_check_config)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
Exemple #4
0
    def test_update_uptime_check_config(self):
        # Setup Expected Response
        name = 'name3373707'
        display_name = 'displayName1615086568'
        is_internal = True
        expected_response = {
            'name': name,
            'display_name': display_name,
            'is_internal': is_internal
        }
        expected_response = uptime_pb2.UptimeCheckConfig(**expected_response)

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

        # Setup Request
        uptime_check_config = {}

        response = client.update_uptime_check_config(uptime_check_config)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.UpdateUptimeCheckConfigRequest(
            uptime_check_config=uptime_check_config)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
Exemple #5
0
    def test_get_uptime_check_config(self):
        # Setup Expected Response
        name_2 = 'name2-1052831874'
        display_name = 'displayName1615086568'
        is_internal = True
        expected_response = {
            'name': name_2,
            'display_name': display_name,
            'is_internal': is_internal
        }
        expected_response = uptime_pb2.UptimeCheckConfig(**expected_response)

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

        # Setup Request
        name = client.uptime_check_config_path('[PROJECT]',
                                               '[UPTIME_CHECK_CONFIG]')

        response = client.get_uptime_check_config(name)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.GetUptimeCheckConfigRequest(
            name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_create_uptime_check_config(self):
        # Setup Expected Response
        name = 'name3373707'
        display_name = 'displayName1615086568'
        expected_response = {'name': name, 'display_name': display_name}
        expected_response = uptime_pb2.UptimeCheckConfig(**expected_response)

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

        # Setup Request
        parent = client.project_path('[PROJECT]')
        uptime_check_config = {}

        response = client.create_uptime_check_config(parent,
                                                     uptime_check_config)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = uptime_service_pb2.CreateUptimeCheckConfigRequest(
            parent=parent, uptime_check_config=uptime_check_config)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request