From 09f5ccc3e47fd96fa21a784e045562e0219eadf3 Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Wed, 7 Jul 2021 12:08:37 +0200 Subject: [PATCH] Small cleanups --- ianardap.py | 4 +++- tests.yaml | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) mode change 100644 => 100755 ianardap.py diff --git a/ianardap.py b/ianardap.py old mode 100644 new mode 100755 index 24cd5e6..1de37a6 --- a/ianardap.py +++ b/ianardap.py @@ -17,7 +17,7 @@ import fcntl IANABASE = "https://data.iana.org/rdap/dns.json" CACHE = os.environ["HOME"] + "/.ianardapcache.json" MAXAGE = 24 # Hours -IANATIMEOUT = 10 +IANATIMEOUT = 10 # Seconds class IanaRDAPDatabase(): @@ -67,6 +67,8 @@ class IanaRDAPDatabase(): def find(self, domain): """ Get the RDAP server for a given domain name. None if there is none.""" + if domain.endswith("."): + domain = domain[:-1] labels = domain.split(".") tld = labels[len(labels)-1] if tld in self.services: diff --git a/tests.yaml b/tests.yaml index d23002c..4ea49c1 100644 --- a/tests.yaml +++ b/tests.yaml @@ -72,6 +72,15 @@ tests: stderr: '' partstdout: 'RDAP server is' + - exe: './check_expire' + args: + - '-u' + - '-H' + - 'bortzmeyer.org' + retcode: 0 + stderr: '' + # TODO how to test we get an integer? + - exe: './check_expire' args: - '-c'