mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 04:29:33 +02:00
parent
4163ee9017
commit
1c560b1748
2 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
class EppSession < ActiveRecord::Base
|
class EppSession < ActiveRecord::Base
|
||||||
before_save :marshal_data!
|
before_save :marshal_data!
|
||||||
|
|
||||||
|
validates :session_id, presence: true
|
||||||
|
|
||||||
belongs_to :registrar
|
belongs_to :registrar
|
||||||
# rubocop: disable Rails/ReadWriteAttribute
|
# rubocop: disable Rails/ReadWriteAttribute
|
||||||
# Turned back to read_attribute, thus in Rails 4
|
# Turned back to read_attribute, thus in Rails 4
|
||||||
|
|
|
@ -1,8 +1,17 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class EppSessionTest < ActiveSupport::TestCase
|
class EppSessionTest < ActiveSupport::TestCase
|
||||||
|
def setup
|
||||||
|
@epp_session = epp_sessions(:api_bestnames)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_valid
|
||||||
|
assert @epp_session.valid?
|
||||||
|
end
|
||||||
|
|
||||||
def test_api_user_id_serialization
|
def test_api_user_id_serialization
|
||||||
epp_session = EppSession.new
|
epp_session = EppSession.new
|
||||||
|
epp_session.session_id = 'test'
|
||||||
epp_session.registrar = registrars(:bestnames)
|
epp_session.registrar = registrars(:bestnames)
|
||||||
epp_session[:api_user_id] = ActiveRecord::Fixtures.identify(:api_bestnames)
|
epp_session[:api_user_id] = ActiveRecord::Fixtures.identify(:api_bestnames)
|
||||||
epp_session.save!
|
epp_session.save!
|
||||||
|
@ -10,4 +19,10 @@ class EppSessionTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_equal ActiveRecord::Fixtures.identify(:api_bestnames), epp_session[:api_user_id]
|
assert_equal ActiveRecord::Fixtures.identify(:api_bestnames), epp_session[:api_user_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_session_id_presence_validation
|
||||||
|
@epp_session.session_id = nil
|
||||||
|
@epp_session.validate
|
||||||
|
assert @epp_session.invalid?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue