

def testRendersGrrMessagePayloadAsStructuredData(self):
    sample = rdf_flows.GrrMessage(task_id=42, payload=ApiRDFProtoStructRendererSample(index=43, values=['foo', 'bar']))
    renderer = api_value_renderers.ApiGrrMessageRenderer()
    data = sample.RenderValue(sample)
    model_data = {
        'age': 0,
        'type': 'GrrMessage',
        'value': {
            'task_id': {
                'age': 0,
                'type': 'long',
                'value': 42,
            },
            'payload_type': {
                'age': 0,
                'type': 'unicode',
                'value': 'ApiRDFProtoStructRendererSample',
            },
            'payload': {
                'age': 0,
                'type': 'ApiRDFProtoStructRendererSample',
                'value': {
                    'index': {
                        'age': 0,
                        'type': 'long',
                        'value': 43,
                    },
                    'values': [{
                        'age': 0,
                        'type': 'unicode',
                        'value': 'foo',
                    }, {
                        'age': 0,
                        'type': 'unicode',
                        'value': 'bar',
                    }],
                },
            },
        },
    }
    self.assertEqual(data, model_data)

dataset/ETHPy150Open google/grr/grr/gui/api_value_renderers_test.py ApiGrrMessageRendererTest.testRendersGrrMessagePayloadAsStructuredData/VarMisuse@48/78 `renderer`->`sample`