From 2ec52cc11b34b33bc5f19d99c2b91cc647a49d0c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 22 Feb 2024 14:45:19 +0000 Subject: [PATCH] lua: Check if we can read the network's properties Signed-off-by: Michael Tremer --- tests/lua/main.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/lua/main.lua b/tests/lua/main.lua index 5be4873..baf1f76 100755 --- a/tests/lua/main.lua +++ b/tests/lua/main.lua @@ -43,7 +43,11 @@ function test_lookup() db = location.Database.open(ENV_TEST_DATABASE) -- Perform a lookup - db.lookup("81.3.27.32") + network = db:lookup("81.3.27.32") + + luaunit.assertEquals(network:get_family(), 2) -- AF_INET + luaunit.assertEquals(network:get_country_code(), "DE") + luaunit.assertEquals(network:get_asn(), 24679) end function test_network() @@ -55,7 +59,7 @@ function test_network() luaunit.assertNil(n1:get_asn()) -- The family should be IPv4 - luaunit.assertEquals(n1:get_family(), 2) + luaunit.assertEquals(n1:get_family(), 2) -- AF_INET -- The country code should be empty luaunit.assertNil(n1:get_country_code()) -- 2.47.3