Fix epp session test, now api_user honors active boolean correctly

This commit is contained in:
Priit Tark 2015-02-27 13:42:59 +02:00
parent 061015e88a
commit 527bc2a0dc
4 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -0,0 +1,5 @@
class ChangeApiUserDefaultValue < ActiveRecord::Migration
def change
change_column_default :users, :active, nil
end
end

View file

@ -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"

View file

@ -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