Commit cbecd39f authored by Łukasz Nowak's avatar Łukasz Nowak

check_surykatka_json: Fix support for missing expiration_date

parent 35f71746
Pipeline #32835 passed with stage
in 0 seconds
......@@ -304,7 +304,8 @@ class RunPromise(GenericPromise):
entry = entry_list[0]
expiration_date = entry['expiration_date']
if expiration_date is None:
self.appendError('Expiration date not avaliable')
self.appendError('%s expiration date not avaliable' % (entry['domain'],))
return
timetuple = email.utils.parsedate(expiration_date)
if timetuple is None:
self.appendError("Can't parse date %s" % (expiration_date,))
......
......@@ -585,6 +585,10 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin):
"domain": "whoisminus29.com",
"expiration_date": self.time_past29d
},
{
"domain": "whoisnone.com",
"expiration_date": None
},
]
})
......@@ -662,6 +666,17 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin):
"whois: ERROR whoisminus29.com expires in < 30 days"
)
def test_none(self):
self.writeSurykatkaPromise(
{
'url': 'https://www.whoisnone.com/',
}
)
self.runAndAssertFailedMessage(
"https://www.whoisnone.com/ : "
"whois: ERROR whoisnone.com expiration date not avaliable"
)
class TestCheckSurykatkaJSONHttpQueryTcpServer(CheckSurykatkaJSONMixin):
def setUp(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment