blob: 56833f0ecefe645ce43ff44d06aa6ed687856bec [file] [log] [blame]
Patrick Venture8a4f2aa2019-05-23 08:40:21 -07001/**
2 * The goal of these tests is to verify the behavior of all blob commands given
3 * the current state is notYetStarted. The initial state.
4 */
5#include "firmware_handler.hpp"
6#include "firmware_unittest.hpp"
7
8#include <gtest/gtest.h>
9
10namespace ipmi_flash
11{
12namespace
13{
14
15using ::testing::UnorderedElementsAreArray;
16
17class FirmwareHandlerNotYetStartedTest : public IpmiOnlyFirmwareStaticTest
18{
19};
20
21/*
22 * There are the following calls (parameters may vary):
23 * Note: you cannot have a session yet, so only commands that don't take a
24 * session parameter are valid. Once you open() from this state, we will vary
25 * you transition out of this state (ensuring the above is true). Technically
26 * the firmware handler receives the session number with open(), but the blob
27 * manager is providing this normally.
28 *
29 * canHandleBlob
30 * getBlobIds
31 * deleteBlob
32 * stat
33 * open
34 *
35 * canHandleBlob is just a count check (or something similar) against what is
36 * returned by getBlobIds. It is tested in firmware_canhandle_unittest
37 */
38
39TEST_F(FirmwareHandlerNotYetStartedTest, GetBlobListValidateListContents)
40{
41 /* TODO: Presently /flash/verify is present from the beginning, however,
42 * this is going to change to simplify handling of open().
43 */
44 std::vector<std::string> expectedBlobs = {staticLayoutBlobId, hashBlobId,
45 verifyBlobId};
46
47 EXPECT_THAT(handler->getBlobIds(),
48 UnorderedElementsAreArray(expectedBlobs));
49}
50
51} // namespace
52} // namespace ipmi_flash