From: Michael Tremer Date: Thu, 22 Feb 2024 14:45:19 +0000 (+0000) Subject: lua: Check if we can read the network's properties X-Git-Tag: 0.9.18~158 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ec52cc11b34b33bc5f19d99c2b91cc647a49d0c;p=people%2Fms%2Flibloc.git lua: Check if we can read the network's properties Signed-off-by: Michael Tremer --- 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())