proto_response v0.4.0 ProtoResponse
Provides helper function similar to Phoenix.ConnTest.json_response/2, but for protobufs.
Link to this section Summary
Functions
Helper function similar to Phoenix.ConnTest.json_response/2
, but for
protobufs
Link to this section Functions
Link to this function
proto_response(conn, code, proto)
Helper function similar to Phoenix.ConnTest.json_response/2
, but for
protobufs.
Asserts the given status code, that we have an application/x-protobuf response and returns the decoded protobuf.
Doesn’t validate decoded protobuf corectness. If wrong protobuf module is provided it may still pass unless protobuf library makes decode/1 function to fail.
Tested with exprotobuf
and protobuf
packages, but it should work
with any solution that creates module with decode/1
function.
Example:
test "valid response", %{conn: conn} do
#...
assert proto_response(conn, 200, ProtoModule.ProtoMessage)
end