blob: 931c59f594b87a465d4265dcce1cd10d45e1d2a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "helper.hpp"
#include "status.hpp"
#include <cstdint>
#include <ipmiblob/test/blob_interface_mock.hpp>
#include <gtest/gtest.h>
namespace host_tool
{
using ::testing::Return;
using ::testing::TypedEq;
class UpdaterTest : public ::testing::Test
{
protected:
ipmiblob::BlobInterfaceMock blobMock;
std::uint16_t session = 0xbeef;
};
TEST_F(UpdaterTest, PollStatusReturnsAfterSuccess)
{
ipmiblob::StatResponse verificationResponse = {};
/* the other details of the response are ignored, and should be. */
verificationResponse.metadata.push_back(
static_cast<std::uint8_t>(ipmi_flash::ActionStatus::success));
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
EXPECT_TRUE(pollStatus(session, &blobMock));
}
TEST_F(UpdaterTest, PollStatusReturnsAfterFailure)
{
ipmiblob::StatResponse verificationResponse = {};
/* the other details of the response are ignored, and should be. */
verificationResponse.metadata.push_back(
static_cast<std::uint8_t>(ipmi_flash::ActionStatus::failed));
EXPECT_CALL(blobMock, getStat(TypedEq<std::uint16_t>(session)))
.WillOnce(Return(verificationResponse));
EXPECT_FALSE(pollStatus(session, &blobMock));
}
} // namespace host_tool
|