blob: implement deleteBlob command

Implement the deleteBlob command for the blob handler. Adding a unit
test to go along with it.

Change-Id: I2bbc93a6e78d5311bd2033d6a8b179374777f794
Signed-off-by: Brandon Kim <brandonkim@google.com>
diff --git a/test/tools_blob_unittest.cpp b/test/tools_blob_unittest.cpp
index 3fe7974..fff3a56 100644
--- a/test/tools_blob_unittest.cpp
+++ b/test/tools_blob_unittest.cpp
@@ -449,4 +449,32 @@
     EXPECT_EQ(blob.readBytes(0x0001, 0, 4), expectedBytes);
 }
 
+TEST_F(BlobHandlerTest, deleteBlobSucceeds)
+{
+    /* The delete succeeds. */
+    auto ipmi = CreateIpmiMock();
+    IpmiInterfaceMock* ipmiMock =
+        reinterpret_cast<IpmiInterfaceMock*>(ipmi.get());
+    BlobHandler blob(std::move(ipmi));
+
+    std::vector<std::uint8_t> request = {
+        0xcf, 0xc2,
+        0x00, static_cast<std::uint8_t>(BlobOEMCommands::bmcBlobDelete),
+        0x00, 0x00,
+        'a',  'b',
+        'c',  'd',
+        0x00};
+
+    std::vector<std::uint8_t> resp = {0xcf, 0xc2, 0x00};
+    std::vector<std::uint8_t> reqCrc = {'a', 'b', 'c', 'd', 0x00};
+    EXPECT_CALL(crcMock, generateCrc(ContainerEq(reqCrc)))
+        .WillOnce(Return(0x00));
+
+    EXPECT_CALL(*ipmiMock,
+                sendPacket(ipmiOEMNetFn, ipmiOEMBlobCmd, ContainerEq(request)))
+        .WillOnce(Return(resp));
+
+    blob.deleteBlob("abcd");
+}
+
 } // namespace ipmiblob