21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-23 02:38:49 +02:00
chexpire/test/services/whois/parser/fr_test.rb

31 lines
954 B
Ruby
Raw Normal View History

2018-05-30 12:04:07 +02:00
require "test_helper"
require "whois/parser/fr"
require "whois/response"
2018-05-30 18:15:20 +02:00
require "whois/errors"
2018-05-30 12:04:07 +02:00
module Whois
class FrTest < ActiveSupport::TestCase
test "should parse a whois response" do
2018-05-30 18:15:20 +02:00
parser = Parser::Fr.new("domain.fr")
domain_fr = file_fixture("whois/domain.fr.txt").read
response = parser.parse(domain_fr)
2018-05-30 12:04:07 +02:00
assert_kind_of Response, response
2018-05-30 16:48:25 +02:00
assert_equal Time.new(2004, 2, 18, 0, 0, 0, 0), response.created_at
assert response.created_at.utc?
assert_equal Time.new(2017, 1, 28, 0, 0, 0, 0), response.updated_at
assert_equal Time.new(2019, 2, 17, 0, 0, 0, 0), response.expire_at
2018-05-30 12:04:07 +02:00
end
2018-05-30 18:15:20 +02:00
test "should raises DomainNotFoundError when domain is not registered" do
parser = Parser::Fr.new("willneverexist.fr")
not_found_fr = file_fixture("whois/willneverexist.fr.txt").read
assert_raises DomainNotFoundError do
parser.parse(not_found_fr)
end
end
2018-05-30 12:04:07 +02:00
end
end