| 511 | |
| 512 | |
| 513 | inline ::testing::AssertionResult AwaitAssertResponseHeaderEq( |
| 514 | const char* expectedExpr, |
| 515 | const char* keyExpr, |
| 516 | const char* actualExpr, |
| 517 | const char* durationExpr, |
| 518 | const std::string& expected, |
| 519 | const std::string& key, |
| 520 | const process::Future<process::http::Response>& actual, |
| 521 | const Duration& duration) |
| 522 | { |
| 523 | const ::testing::AssertionResult result = |
| 524 | AwaitAssertReady(actualExpr, durationExpr, actual, duration); |
| 525 | |
| 526 | if (result) { |
| 527 | const Option<std::string> value = actual->headers.get(key); |
| 528 | if (value.isNone()) { |
| 529 | return ::testing::AssertionFailure() |
| 530 | << "Response does not contain header '" << key << "'"; |
| 531 | } else if (expected == value.get()) { |
| 532 | return ::testing::AssertionSuccess(); |
| 533 | } else { |
| 534 | return ::testing::AssertionFailure() |
| 535 | << "Value of: (" << actualExpr << ")->headers[" << keyExpr << "]\n" |
| 536 | << " Actual: " << ::testing::PrintToString(value.get()) << "\n" |
| 537 | << "Expected: " << expectedExpr << "\n" |
| 538 | << "Which is: " << ::testing::PrintToString(expected); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | return result; |
| 543 | } |
| 544 | |
| 545 | |
| 546 | #define AWAIT_ASSERT_RESPONSE_HEADER_EQ_FOR(expected, key, actual, duration) \ |
nothing calls this directly
no test coverage detected