From 53b673439532fb6a3965810e4aec212220949ee3 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Mon, 12 Jan 2015 16:41:48 +0200 Subject: [PATCH] Request success field to boolean, test improvement --- db/api_log_schema.rb | 4 ++-- .../20150109081914_create_api_log_tables.rb | 4 ++-- spec/epp/domain_spec.rb | 24 +++++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/db/api_log_schema.rb b/db/api_log_schema.rb index 2f469bb15..ecaee6605 100644 --- a/db/api_log_schema.rb +++ b/db/api_log_schema.rb @@ -21,7 +21,7 @@ ActiveRecord::Schema.define(version: 0) do t.text "response" t.string "request_command" t.string "request_object" - t.string "request_successful" + t.boolean "request_successful" t.string "api_user_name" t.string "api_user_registrar" t.datetime "created_at" @@ -33,7 +33,7 @@ ActiveRecord::Schema.define(version: 0) do t.text "response" t.string "request_command" t.string "request_object" - t.string "request_successful" + t.boolean "request_successful" t.string "api_user_name" t.string "api_user_registrar" t.datetime "created_at" diff --git a/db/migrate/20150109081914_create_api_log_tables.rb b/db/migrate/20150109081914_create_api_log_tables.rb index eab83ff2d..7bb074c0e 100644 --- a/db/migrate/20150109081914_create_api_log_tables.rb +++ b/db/migrate/20150109081914_create_api_log_tables.rb @@ -9,7 +9,7 @@ class CreateApiLogTables < ActiveRecord::Migration t.text :response t.string :request_command t.string :request_object - t.string :request_successful + t.boolean :request_successful t.string :api_user_name t.string :api_user_registrar @@ -21,7 +21,7 @@ class CreateApiLogTables < ActiveRecord::Migration t.text :response t.string :request_command t.string :request_object - t.string :request_successful + t.boolean :request_successful t.string :api_user_name t.string :api_user_registrar diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index 64c3a6fda..38291dafa 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -39,6 +39,30 @@ describe 'EPP Domain', epp: true do expect(response[:results][1][:value]).to eq('sh801333') expect(response[:clTRID]).to eq('ABC-12345') + + log = ApiLog::EppLog.all + + expect(log.length).to eq(4) + expect(log[0].request_command).to eq('hello') + expect(log[0].request_successful).to eq(true) + + expect(log[1].request_command).to eq('login') + expect(log[1].request_successful).to eq(true) + expect(log[1].api_user_name).to eq('zone') + expect(log[1].api_user_registrar).to eq('Registrar OÜ') + + expect(log[2].request_command).to eq('create') + expect(log[2].request_object).to eq('domain') + expect(log[2].request_successful).to eq(false) + expect(log[2].api_user_name).to eq('zone') + expect(log[2].api_user_registrar).to eq('Registrar OÜ') + expect(log[2].request).not_to be_blank + expect(log[2].response).not_to be_blank + + expect(log[3].request_command).to eq('logout') + expect(log[3].request_successful).to eq(true) + expect(log[3].api_user_name).to eq('zone') + expect(log[3].api_user_registrar).to eq('Registrar OÜ') end it 'validates required parameters' do