mirror of
https://github.com/internetee/registry.git
synced 2025-07-26 04:28:27 +02:00
test: removed unless tests, added new tests for dnskey and for domain
This commit is contained in:
parent
853e4c447b
commit
3a77e420bd
6 changed files with 79 additions and 24 deletions
11
test/helpers/form_helper_test.rb
Normal file
11
test/helpers/form_helper_test.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FormHelperTest < ActionView::TestCase
|
||||
def test_legal_document_field
|
||||
meth = MiniTest::Mock.new
|
||||
returned_legal_document_field = ApplicationController.helpers.legal_document_field('Hello', meth)
|
||||
|
||||
assert returned_legal_document_field.include? 'data-legal-document="true"'
|
||||
assert returned_legal_document_field.include? 'accept=".pdf,.asice,.asics,.sce,.scs,.adoc,.edoc,.bdoc,.zip,.rar,.gz,.tar,.7z,.odt,.doc,.docx"'
|
||||
end
|
||||
end
|
9
test/helpers/form_tag_helper_test.rb
Normal file
9
test/helpers/form_tag_helper_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FormTagHelperTest < ActionView::TestCase
|
||||
def test_legal_document_field
|
||||
returned_legal_document_field = ApplicationController.helpers.legal_document_field_tag('Hello')
|
||||
assert returned_legal_document_field.include? 'data-legal-document="true"'
|
||||
assert returned_legal_document_field.include? 'accept=".pdf,.asice,.asics,.sce,.scs,.adoc,.edoc,.bdoc,.zip,.rar,.gz,.tar,.7z,.odt,.doc,.docx"'
|
||||
end
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrantAreaDomainUpdateConfirmsIntegrationTest < ApplicationIntegrationTest
|
||||
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_show_confirm_to_update_domain
|
||||
@domain.update!(registrant_verification_asked_at: Time.zone.now,
|
||||
registrant_verification_token: 'test',
|
||||
statuses: [DomainStatus::PENDING_UPDATE])
|
||||
|
||||
get registrant_domain_update_confirm_path(@domain, token: 'test', confirmed: true)
|
||||
|
||||
assert @domain.registrant_update_confirmable?('test')
|
||||
end
|
||||
end
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarAreaDomainsIntegrationTest < ApplicationIntegrationTest
|
||||
include FormTagHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
|
|
@ -178,6 +178,10 @@ class DNS::ZoneTest < ActiveSupport::TestCase
|
|||
assert_nil Whois::Record.find_by(name: subzone.origin)
|
||||
end
|
||||
|
||||
def test_generate_zonefile
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_zone
|
||||
|
|
|
@ -1,11 +1,58 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DnskeyTest < ActiveSupport::TestCase
|
||||
include EppErrors
|
||||
|
||||
setup do
|
||||
@dnskey = 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8'
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_dns_key
|
||||
def test_valid_dns_key
|
||||
dns = Dnskey.new
|
||||
dns.domain_id = @domain.id
|
||||
dns.flags = 257
|
||||
dns.protocol = 3
|
||||
dns.alg = 8
|
||||
dns.public_key = @dnskey
|
||||
|
||||
assert dns.save
|
||||
end
|
||||
|
||||
def test_invalid_algrorithm
|
||||
dns = Dnskey.new
|
||||
dns.alg = 666
|
||||
errors = dns.validate_algorithm
|
||||
assert_equal errors, ['Valid algorithms are: 3, 5, 6, 7, 8, 10, 13, 14']
|
||||
end
|
||||
|
||||
def test_invalid_protocol
|
||||
dns = Dnskey.new
|
||||
dns.protocol = 666
|
||||
errors = dns.validate_protocol
|
||||
assert_equal errors, ['Valid protocols are: 3']
|
||||
end
|
||||
|
||||
def test_invalid_flags
|
||||
dns = Dnskey.new
|
||||
dns.flags = 666
|
||||
errors = dns.validate_flags
|
||||
assert_equal errors, ['Valid flags are: 0, 256, 257']
|
||||
end
|
||||
|
||||
def test_ds_digest_type_one
|
||||
Setting.ds_digest_type = 1
|
||||
|
||||
dns = Dnskey.new
|
||||
dns.domain_id = @domain.id
|
||||
dns.flags = 257
|
||||
dns.protocol = 3
|
||||
dns.alg = 8
|
||||
dns.public_key = @dnskey
|
||||
|
||||
assert dns.save
|
||||
|
||||
assert_equal dns.ds_digest_type, 1
|
||||
assert_equal dns.ds_digest, '640D173A44D9AF2856FBE282EE64CE11A76DBB84'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue