

def test_simple_pb_request(self):
    data = Person()
    data.id = 1
    data.name = 'tester'
    data.email = 'tester@example.com'
    app = flask.Flask(__name__)
    with app.test_request_context(data=data.SerializeToString(), method='POST', content_type='application/x-protobuf', headers={
        'Accept': 'application/x-protobuf',
    }):

        @api(protobuf(receives=Person))
        def view_method():
            self.assertEqual(flask.request.data_dict, {
                'id': 1,
                'name': 'tester',
                'email': 'tester@example.com',
            })
            return 200
        view_method()

dataset/ETHPy150Open keenbrowne/flask-pbj/tests.py TestProtobuf.test_simple_pb_request/original