inline ::testing::AssertionResult AwaitAssertResponseBodyEq( const char* expectedExpr, const char* actualExpr, const char* durationExpr, const std::string& expected, const process::Future<process::http::Response>& actual, const Duration& duration) { const ::testing::AssertionResult result = AwaitAssertReady(actualExpr, durationExpr, actual, duration); if (result) { if (expected == actual.get().body) { return ::testing::AssertionSuccess(); } else { return ::testing::AssertionFailure() << "Value of: (" << actualExpr << ").get().body\n" << " Actual: " << ::testing::PrintToString(actual.get().body) << "\n" << "Expected: " << expectedExpr << "\n" << "Which is: " << ::testing::PrintToString(expected); } } return result; }
inline ::testing::AssertionResult AwaitAssertResponseHeaderEq( const char* expectedExpr, const char* keyExpr, const char* actualExpr, const char* durationExpr, const std::string& expected, const std::string& key, const process::Future<process::http::Response>& actual, const Duration& duration) { const ::testing::AssertionResult result = AwaitAssertReady(actualExpr, durationExpr, actual, duration); if (result) { const Option<std::string> value = actual.get().headers.get(key); if (value.isNone()) { return ::testing::AssertionFailure() << "Response does not contain header '" << key << "'"; } else if (expected == value.get()) { return ::testing::AssertionSuccess(); } else { return ::testing::AssertionFailure() << "Value of: (" << actualExpr << ").get().headers[" << keyExpr << "]\n" << " Actual: " << ::testing::PrintToString(value.get()) << "\n" << "Expected: " << expectedExpr << "\n" << "Which is: " << ::testing::PrintToString(expected); } } return result; }
inline ::testing::AssertionResult AwaitAssertSignaled( const char* actualExpr, const char* durationExpr, const process::Future<Option<int>>& actual, const Duration& duration) { const ::testing::AssertionResult result = AwaitAssertReady(actualExpr, durationExpr, actual, duration); if (result) { CHECK_READY(actual); if (actual->isNone()) { return ::testing::AssertionFailure() << "(" << actualExpr << ")->isNone() is true"; } return AssertSignaled( strings::join("(", actualExpr, ")->get()").c_str(), actual->get()); } return result; }