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): ...@@ -304,7 +304,8 @@ class RunPromise(GenericPromise):
entry = entry_list[0] entry = entry_list[0]
expiration_date = entry['expiration_date'] expiration_date = entry['expiration_date']
if expiration_date is None: 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) timetuple = email.utils.parsedate(expiration_date)
if timetuple is None: if timetuple is None:
self.appendError("Can't parse date %s" % (expiration_date,)) self.appendError("Can't parse date %s" % (expiration_date,))
......
...@@ -585,6 +585,10 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin): ...@@ -585,6 +585,10 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin):
"domain": "whoisminus29.com", "domain": "whoisminus29.com",
"expiration_date": self.time_past29d "expiration_date": self.time_past29d
}, },
{
"domain": "whoisnone.com",
"expiration_date": None
},
] ]
}) })
...@@ -662,6 +666,17 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin): ...@@ -662,6 +666,17 @@ class TestCheckSurykatkaJSONHttpQueryWhois(CheckSurykatkaJSONMixin):
"whois: ERROR whoisminus29.com expires in < 30 days" "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): class TestCheckSurykatkaJSONHttpQueryTcpServer(CheckSurykatkaJSONMixin):
def setUp(self): 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