move dns update job here

This commit is contained in:
Torsten
2023-02-11 22:35:45 +02:00
parent df6af95ff9
commit 41771ad5c1
13 changed files with 97 additions and 26 deletions

View File

@ -1,4 +0,0 @@
# one:
# record: name_of_fixture (ClassOfFixture)
# name: content
# body: <p>In a <i>million</i> stars!</p>

View File

@ -3,11 +3,9 @@
one:
name: MyString
ha_id: MyString
type:
member: one
two:
name: MyString
ha_id: MyString
type:
member: two

View File

View File

@ -1,9 +1,7 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
public: false
email: email1
two:
name: MyString
public: false
email: email2

View File

@ -5,9 +5,11 @@ one:
bio: MyString
picture: MyString
member: one
kind: artist
two:
name: MyString
bio: MyString
picture: MyString
member: two
kind: member

View File

@ -0,0 +1,30 @@
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