From 527bc2a0dc7a2ef587576c0aab00b7e46413241d Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Fri, 27 Feb 2015 13:42:59 +0200 Subject: [PATCH] Fix epp session test, now api_user honors active boolean correctly --- app/models/api_user.rb | 2 +- .../20150227113121_change_api_user_default_value.rb | 5 +++++ db/schema.rb | 8 ++++---- spec/epp/session_spec.rb | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20150227113121_change_api_user_default_value.rb diff --git a/app/models/api_user.rb b/app/models/api_user.rb index cd07282b7..d95ce8414 100644 --- a/app/models/api_user.rb +++ b/app/models/api_user.rb @@ -20,7 +20,7 @@ class ApiUser < User after_initialize :set_defaults def set_defaults return unless new_record? - self.active = true + self.active = true unless active_changed? end def registrar_typeahead diff --git a/db/migrate/20150227113121_change_api_user_default_value.rb b/db/migrate/20150227113121_change_api_user_default_value.rb new file mode 100644 index 000000000..614abb587 --- /dev/null +++ b/db/migrate/20150227113121_change_api_user_default_value.rb @@ -0,0 +1,5 @@ +class ChangeApiUserDefaultValue < ActiveRecord::Migration + def change + change_column_default :users, :active, nil + end +end diff --git a/db/schema.rb b/db/schema.rb index cb37d9166..4630543d3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150223104842) do +ActiveRecord::Schema.define(version: 20150227113121) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -640,19 +640,19 @@ ActiveRecord::Schema.define(version: 20150223104842) do t.datetime "created_at" t.datetime "updated_at" t.string "email" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.inet "current_sign_in_ip" t.inet "last_sign_in_ip" t.string "identity_code" t.integer "country_id" - t.string "roles", array: true + t.string "roles", array: true t.string "creator_str" t.string "updator_str" t.string "country_code" t.integer "registrar_id" - t.boolean "active", default: false + t.boolean "active" t.text "csr" t.text "crt" t.string "type" diff --git a/spec/epp/session_spec.rb b/spec/epp/session_spec.rb index 2da903652..e0e8afae9 100644 --- a/spec/epp/session_spec.rb +++ b/spec/epp/session_spec.rb @@ -35,6 +35,7 @@ describe 'EPP Session', epp: true do inactive = @epp_xml.session.login(clID: { value: 'inactive-user' }, pw: { value: 'ghyt9e4fu' }) response = epp_plain_request(inactive, :xml) + response[:msg].should == 'Authentication error; server closing connection' response[:result_code].should == '2501' end