31 lines
793 B
Ruby
31 lines
793 B
Ruby
|
require "test_helper"
|
||
|
require "dns_update_job"
|
||
|
|
||
|
class DnsJobTest < ActiveJob::TestCase
|
||
|
|
||
|
def test_update_ip
|
||
|
updater = DnsUpdateJob.new
|
||
|
updater.update_ip("dnsimple_test","hubfeenix.fi")
|
||
|
zone = updater.find_record("dnsimple_test","hubfeenix.fi")
|
||
|
assert_equal zone.content, updater.my_ip
|
||
|
end
|
||
|
|
||
|
def test_get_ip
|
||
|
res = DnsUpdateJob.new.my_ip
|
||
|
assert res.start_with? "84"
|
||
|
end
|
||
|
|
||
|
def test_init_client
|
||
|
client = DnsUpdateJob.new.client
|
||
|
assert_equal client.class, Dnsimple::Client
|
||
|
end
|
||
|
|
||
|
def test_find_domain
|
||
|
updater = DnsUpdateJob.new
|
||
|
zone = updater.find_record("dnsimple_test","hubfeenix.fi")
|
||
|
assert_equal zone.class, Dnsimple::Struct::ZoneRecord
|
||
|
assert_equal zone.name, "dnsimple_test"
|
||
|
assert_equal zone.content, updater.my_ip
|
||
|
end
|
||
|
end
|