mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
Move size constant to LegalDocument class
This commit is contained in:
parent
9f21b1704c
commit
31a463c587
3 changed files with 4 additions and 7 deletions
|
@ -23,8 +23,6 @@ module Epp
|
||||||
rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error
|
rescue_from ActiveRecord::RecordNotFound, with: :respond_with_object_does_not_exist_error
|
||||||
before_action :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
EIGHT_MEGABYTES = 8_388_608
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def respond_with_command_failed_error(exception)
|
def respond_with_command_failed_error(exception)
|
||||||
|
@ -72,7 +70,7 @@ module Epp
|
||||||
end
|
end
|
||||||
|
|
||||||
def error_code(error)
|
def error_code(error)
|
||||||
error.str1.present? && error.str1.size > EIGHT_MEGABYTES ? 2306 : 2001
|
error.str1.present? && error.str1.size > LegalDocument::MAX_BODY_SIZE ? 2306 : 2001
|
||||||
end
|
end
|
||||||
|
|
||||||
def schema
|
def schema
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class LegalDocument < ApplicationRecord
|
class LegalDocument < ApplicationRecord
|
||||||
include EppErrors
|
include EppErrors
|
||||||
MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil
|
MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil
|
||||||
|
MAX_BODY_SIZE = 8.megabytes
|
||||||
|
|
||||||
if ENV['legal_document_types'].present?
|
if ENV['legal_document_types'].present?
|
||||||
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
|
TYPES = ENV['legal_document_types'].split(',').map(&:strip)
|
||||||
|
|
|
@ -82,8 +82,7 @@ class EppDomainCreateBaseTest < EppTestCase
|
||||||
contact = contacts(:john)
|
contact = contacts(:john)
|
||||||
registrant = contact.becomes(Registrant)
|
registrant = contact.becomes(Registrant)
|
||||||
|
|
||||||
# 8388608 bytes == 8 mb
|
bignum_legaldoc = 't' * (LegalDocument::MAX_BODY_SIZE + 1)
|
||||||
bignum_legaldoc = 't' * (8388608 + 1)
|
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
@ -117,8 +116,7 @@ class EppDomainCreateBaseTest < EppTestCase
|
||||||
contact = contacts(:john)
|
contact = contacts(:john)
|
||||||
registrant = contact.becomes(Registrant)
|
registrant = contact.becomes(Registrant)
|
||||||
|
|
||||||
# 8388608 bytes == 8 mb
|
bignum_legaldoc = 't' * LegalDocument::MAX_BODY_SIZE
|
||||||
bignum_legaldoc = 't' * 8388608
|
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue