def test_create_note(self):
        # Setup Expected Response
        name = "name3373707"
        short_description = "shortDescription-235369287"
        long_description = "longDescription-1747792199"
        expected_response = {
            "name": name,
            "short_description": short_description,
            "long_description": long_description,
        }
        expected_response = grafeas_pb2.Note(**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
            address = "[SERVICE_ADDRESS]"

            scopes = "SCOPE"

            transport = grafeas_grpc_transport.GrafeasGrpcTransport(
                address, scopes)

            client = grafeas_v1.GrafeasClient(transport)

        # Setup Request
        parent = client.project_path("[PROJECT]")
        note_id = "noteId2129224840"
        note = {}

        response = client.create_note(parent, note_id, note)
        assert expected_response == response

        assert len(channel.requests) == 1
        expected_request = grafeas_pb2.CreateNoteRequest(parent=parent,
                                                         note_id=note_id,
                                                         note=note)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request
    def test_get_note(self):
        # Setup Expected Response
        name_2 = "name2-1052831874"
        short_description = "shortDescription-235369287"
        long_description = "longDescription-1747792199"
        expected_response = {
            "name": name_2,
            "short_description": short_description,
            "long_description": long_description,
        }
        expected_response = grafeas_pb2.Note(**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
            address = "[SERVICE_ADDRESS]"

            scopes = "SCOPE"

            transport = grafeas_grpc_transport.GrafeasGrpcTransport(
                address, scopes)

            client = grafeas_v1.GrafeasClient(transport)

        # Setup Request
        name = client.note_path("[PROJECT]", "[NOTE]")

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

        assert len(channel.requests) == 1
        expected_request = grafeas_pb2.GetNoteRequest(name=name)
        actual_request = channel.requests[0][1]
        assert expected_request == actual_request