test: add unit-test for tools::blob close

Add a unit-test for the host tool blob close command.

Change-Id: I0d8b8af18dabdae8e6bfc3d48ac708b2d4f838ed
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/tools_blob_unittest.cpp b/test/tools_blob_unittest.cpp
index 7893e3c..18cc6eb 100644
--- a/test/tools_blob_unittest.cpp
+++ b/test/tools_blob_unittest.cpp
@@ -214,6 +214,24 @@
     EXPECT_EQ(0xedfe, session);
 }
 
+TEST_F(BlobHandlerTest, closeBlobSucceeds)
+{
+    /* The close succeeds. */
+    IpmiInterfaceMock ipmiMock;
+    BlobHandler blob(&ipmiMock);
+
+    std::vector<std::uint8_t> request = {
+        0xcf, 0xc2, 0x00, BlobHandler::BlobOEMCommands::bmcBlobClose,
+        0x00, 0x00, 0x01, 0x00};
+    std::vector<std::uint8_t> resp = {0xcf, 0xc2, 0x00};
+    std::vector<std::uint8_t> reqCrc = {0x01, 0x00};
+    EXPECT_CALL(crcMock, generateCrc(Eq(reqCrc))).WillOnce(Return(0x00));
+
+    EXPECT_CALL(ipmiMock, sendPacket(Eq(request))).WillOnce(Return(resp));
+
+    blob.closeBlob(0x0001);
+}
+
 TEST_F(BlobHandlerTest, writeBytesSucceeds)
 {
     /* The write bytes succeeds. */