Jie Yang | fbe1b68 | 2021-02-19 04:54:55 -0800 | [diff] [blame] | 1 | #include "handler_unittest.hpp" |
| 2 | |
| 3 | #include <blobs-ipmid/blobs.hpp> |
| 4 | |
| 5 | #include <cstdint> |
| 6 | |
| 7 | namespace blobs |
| 8 | { |
| 9 | |
| 10 | class SmbiosBlobHandlerOpenTest : public SmbiosBlobHandlerTest |
| 11 | {}; |
| 12 | |
| 13 | TEST_F(SmbiosBlobHandlerOpenTest, OpenWithBadFlagsFails) |
| 14 | { |
| 15 | // SMBIOS blob handler disables read flag |
| 16 | |
| 17 | EXPECT_FALSE(handler.open(session, blobs::OpenFlags::read, expectedBlobId)); |
| 18 | } |
| 19 | |
| 20 | TEST_F(SmbiosBlobHandlerOpenTest, OpenEverythingSucceeds) |
| 21 | { |
| 22 | EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId)); |
| 23 | } |
| 24 | |
| 25 | TEST_F(SmbiosBlobHandlerOpenTest, CannotOpenSameSessionTwice) |
| 26 | { |
| 27 | EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId)); |
| 28 | EXPECT_FALSE( |
| 29 | handler.open(session, blobs::OpenFlags::write, expectedBlobId)); |
| 30 | } |
| 31 | |
| 32 | } // namespace blobs |