diff --git a/test/integration/epp/contact/update/base_test.rb b/test/integration/epp/contact/update/base_test.rb
index 98c0e4462..ff43905de 100644
--- a/test/integration/epp/contact/update/base_test.rb
+++ b/test/integration/epp/contact/update/base_test.rb
@@ -325,6 +325,104 @@ class EppContactUpdateBaseTest < EppTestCase
assert_nil @contact.state
end
+ def test_update_contact_with_update_prohibited
+ @contact.update(statuses: [Contact::CLIENT_UPDATE_PROHIBITED])
+ @contact.update_columns(code: @contact.code.upcase)
+
+ street = '123 Example'
+ city = 'Tallinn'
+ state = 'Harjumaa'
+ zip = '123456'
+ country_code = 'EE'
+
+ request_xml = <<-XML
+
+
+
+
+
+ #{@contact.code}
+
+
+
+ #{street}
+ #{city}
+ #{state}
+ #{zip}
+ #{country_code}
+
+
+
+
+
+
+
+ XML
+
+ post epp_update_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+
+ @contact.reload
+
+ assert_not_equal city, @contact.city
+ assert_not_equal street, @contact.street
+ assert_not_equal zip, @contact.zip
+ assert_not_equal country_code, @contact.country_code
+ assert_not_equal state, @contact.state
+
+ assert_epp_response :object_status_prohibits_operation
+ end
+
+ def test_legal_document
+ assert_equal 'john-001', @contact.code
+ assert_not_equal 'new name', @contact.name
+ assert_not_equal 'new-email@inbox.test', @contact.email
+ assert_not_equal '+123.4', @contact.phone
+
+ Setting.request_confirmation_on_domain_deletion_enabled = false
+
+ # https://github.com/internetee/registry/issues/415
+ @contact.update_columns(code: @contact.code.upcase)
+
+ assert_not @contact.legal_documents.present?
+
+ request_xml = <<-XML
+
+
+
+
+
+ john-001
+
+
+ new name
+
+ +123.4
+ new-email@inbox.test
+
+
+
+
+
+ #{'test' * 2000}
+
+
+
+
+ XML
+
+ assert_difference -> { @contact.legal_documents.reload.size } do
+ post epp_update_path, params: { frame: request_xml },
+ headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
+ @contact.reload
+ end
+
+ assert_epp_response :completed_successfully
+ assert_equal 'new name', @contact.name
+ assert_equal 'new-email@inbox.test', @contact.email
+ assert_equal '+123.4', @contact.phone
+ end
+
private
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
diff --git a/test/jobs/domain_expire_email_job_test.rb b/test/jobs/domain_expire_email_job_test.rb
new file mode 100644
index 000000000..f57de2686
--- /dev/null
+++ b/test/jobs/domain_expire_email_job_test.rb
@@ -0,0 +1,29 @@
+require "test_helper"
+
+class DomainExpireEmailJobTest < ActiveSupport::TestCase
+ setup do
+ @domain = domains(:shop)
+ travel_to Time.zone.parse('2010-08-06')
+ @domain.update(valid_to: Time.now - 1.day)
+ @domain.reload
+ end
+
+ def test_domain_expire
+ success = DomainExpireEmailJob.run(@domain.id)
+ assert success
+ end
+
+ def test_domain_expire_with_force_delete
+ @domain.update(statuses: [DomainStatus::FORCE_DELETE])
+ @domain.reload
+ assert_equal ['serverForceDelete'], @domain.statuses
+
+ success = DomainExpireEmailJob.run(@domain.id)
+ assert success
+
+ statuses = @domain.statuses
+ statuses.delete(DomainStatus::FORCE_DELETE)
+ @domain.update(statuses: statuses)
+ assert_equal ['ok'], @domain.statuses
+ end
+end
\ No newline at end of file
diff --git a/test/lib/validators/date_time_iso8601_validator_test.rb b/test/lib/validators/date_time_iso8601_validator_test.rb
new file mode 100644
index 000000000..f16474707
--- /dev/null
+++ b/test/lib/validators/date_time_iso8601_validator_test.rb
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class DateTimeIso8601Validatable
+ include ActiveModel::Validations
+ validates_with DateTimeIso8601Validator, :attributes=>[:code]
+ attr_accessor :code
+ validates :code, iso8601: { date_only: true }
+end
+
+class DateTimeIso8601ValidatorTest < ActiveSupport::TestCase
+ def test_check_invalid_date
+ obj = DateTimeIso8601Validatable.new
+ obj.code = "22-12-2020"
+ assert_not obj.valid?
+ end
+end
\ No newline at end of file