Skip to content

Commit

Permalink
Reuse response object as expected values
Browse files Browse the repository at this point in the history
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
  • Loading branch information
dio committed Jul 13, 2018
1 parent 40d9b3f commit 9403723
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,10 @@ TEST_F(GrpcJsonTranscoderFilterTest, TranscodingUnaryWithHttpBodyAsOutput) {
EXPECT_EQ(Http::FilterDataStatus::StopIterationAndBuffer,
filter_.encodeData(*response_data, false));

const std::string response_html = response_data->toString();

EXPECT_EQ("text/html", response_headers.get_("content-type"));
EXPECT_EQ("<h1>Hello, world!</h1>", response_html);
EXPECT_EQ(response.content_type(), response_headers.get_("content-type"));
EXPECT_EQ(response.data(), response_data->toString());

Http::TestHeaderMapImpl response_trailers{{"grpc-status", "0"}, {"grpc-message", ""}};

EXPECT_EQ(Http::FilterTrailersStatus::Continue, filter_.decodeTrailers(response_trailers));
}

Expand Down Expand Up @@ -624,13 +621,10 @@ TEST_F(GrpcJsonTranscoderFilterTest, TranscodingUnaryWithHttpBodyAsOutputAndSpli
EXPECT_EQ(Http::FilterDataStatus::StopIterationAndBuffer,
filter_.encodeData(*response_data, false));

const std::string response_html = response_data->toString();

EXPECT_EQ("text/html", response_headers.get_("content-type"));
EXPECT_EQ("<h1>Hello, world!</h1>", response_html);
EXPECT_EQ(response.content_type(), response_headers.get_("content-type"));
EXPECT_EQ(response.data(), response_data->toString());

Http::TestHeaderMapImpl response_trailers{{"grpc-status", "0"}, {"grpc-message", ""}};

EXPECT_EQ(Http::FilterTrailersStatus::Continue, filter_.decodeTrailers(response_trailers));
}

Expand Down

0 comments on commit 9403723

Please sign in to comment.