mirror of
https://github.com/Evolix/chexpire.git
synced 2024-04-27 06:20:50 +02:00
Fix Sonic parsing
This commit is contained in:
parent
e5979c4b2b
commit
3fd1deceb7
|
@ -31,7 +31,8 @@ module Whois
|
||||||
private
|
private
|
||||||
|
|
||||||
def extract_values
|
def extract_values
|
||||||
domain_index = get_field!("Domain Name", value: domain.upcase).index
|
|
||||||
|
domain_index = get_field!("Domain Name", value: domain.downcase).index
|
||||||
|
|
||||||
created_date = get_value!("Creation Date", after: domain_index)
|
created_date = get_value!("Creation Date", after: domain_index)
|
||||||
response.created_at = parse_date(created_date)
|
response.created_at = parse_date(created_date)
|
||||||
|
|
|
@ -14,10 +14,14 @@ module Whois
|
||||||
response = parser.parse(whois_output)
|
response = parser.parse(whois_output)
|
||||||
assert_kind_of Response, response
|
assert_kind_of Response, response
|
||||||
|
|
||||||
assert_equal Time.new(2018, 11, 11, 11, 9, 47, 0), response.created_at
|
assert_equal Time.new(2010, 10, 31, 0, 0, 0, 0), response.created_at
|
||||||
assert response.created_at.utc?
|
assert response.created_at.utc?
|
||||||
|
|
||||||
assert_equal Time.new(2018, 12, 3, 21, 21, 22, 0), response.updated_at
|
# We can't use Time.new here
|
||||||
|
# Sonic times have subseconds and the parsed version
|
||||||
|
# is different than the generated time (which doesn't have
|
||||||
|
# subseconds).
|
||||||
|
assert_equal Time.parse("2018-11-11T11:09:47.823Z"), response.updated_at
|
||||||
assert_equal Time.new(2021, 10, 31, 0, 0, 0, 0), response.expire_at
|
assert_equal Time.new(2021, 10, 31, 0, 0, 0, 0), response.expire_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue