

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

        @api(protobuf(sends=Person))
        def view_method():
            return data
        (response, status_code, headers) = view_method()
    response_data = Person()
    response_data.ParseFromString(response.data)
    self.assertEquals(response_data, person)
    self.assertEquals(response.mimetype, 'application/x-protobuf')
    self.assertEquals(status_code, 200)

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