]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#898] Unit-tests now check for DHCP class
authorTomek Mrugalski <tomasz@isc.org>
Thu, 21 Nov 2019 06:12:35 +0000 (14:12 +0800)
committerFrancis Dupont <fdupont@isc.org>
Tue, 10 Dec 2019 21:30:29 +0000 (22:30 +0100)
doc/sphinx/arm/hooks-bootp.rst
src/hooks/dhcp/bootp/tests/bootp_unittests.cc

index b5a274d9858fb834040c1992b7dbfb951be00e5b..b687d6c003d5d0f4cfbee28c2f8af643eae1f2e9 100644 (file)
@@ -5,7 +5,7 @@ BOOTP support
 
 .. note::
 
-   This is library is still in experimental phase. Use with care! 
+   This is library is still in experimental phase. Use with care!
 
 
 This hooks library adds support for BOOTP with vendor information extensions
index c84bb7259cc7465cf34437431d27f0fe41a1c996..dc5b58fbbd132e796ab773666ca86489a72b4a96 100644 (file)
@@ -90,6 +90,12 @@ public:
         } else {
             EXPECT_EQ(type, pkt->getType());
         }
+
+        if (dhcp) {
+            EXPECT_TRUE(pkt->inClass("DHCP"));
+        } else {
+            EXPECT_FALSE(pkt->inClass("DHCP"));
+        }
     }
 
     /// @brief Callout manager accessed by this CalloutHandle.
@@ -118,7 +124,7 @@ TEST_F(BootpTest, dhcpOffer) {
 TEST_F(BootpTest, bootReply) {
     // The constructor does not allow to directly create a BOOTREPLY packet.
     Pkt4Ptr pkt(new Pkt4(DHCPOFFER, 12345));
-    pkt->setType(DHCP_NOTYPE);
+    //pkt->setType(DHCP_NOTYPE);
     pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
     ASSERT_EQ(BOOTREPLY, pkt->getOp());
     calloutsCall(pkt, false);
@@ -128,7 +134,7 @@ TEST_F(BootpTest, bootReply) {
 TEST_F(BootpTest, bootRequest) {
     // The constructor does not allow to directly create a BOOTREQUEST packet.
     Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 12345));
-    pkt->setType(DHCP_NOTYPE);
+    // pkt->setType(DHCP_NOTYPE);
     pkt->delOption(DHO_DHCP_MESSAGE_TYPE);
     ASSERT_EQ(BOOTREQUEST, pkt->getOp());
     calloutsCall(pkt, true);