From 645e421daf2dc7b5d28e005b82e98aa730bf7e40 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 25 Jul 2016 22:29:10 +0200 Subject: [PATCH] Improved auto wizard test. --- contrib/auto_wizard_example.json | 3 +++ contrib/auto_wizard_test.json | 5 ++++- db/migrate/20120101000010_create_ticket.rb | 1 + db/migrate/20160725000001_update_text_module.rb | 9 +++++++++ test/unit/auto_wizard_test.rb | 11 +++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160725000001_update_text_module.rb diff --git a/contrib/auto_wizard_example.json b/contrib/auto_wizard_example.json index 4f0ead85a..2ac5d280c 100644 --- a/contrib/auto_wizard_example.json +++ b/contrib/auto_wizard_example.json @@ -3,6 +3,9 @@ "CalendarSetup": { "Ip": "195.65.29.254" }, + "TextModuleLocale": { + "Locale": "en-us" + }, "Users": [ { "login": "hans.atila@zammad.org", diff --git a/contrib/auto_wizard_test.json b/contrib/auto_wizard_test.json index 6fe24e154..333b6ba52 100644 --- a/contrib/auto_wizard_test.json +++ b/contrib/auto_wizard_test.json @@ -66,5 +66,8 @@ "name": "product_name", "value": "Zammad Test System" } - ] + ], + "TextModuleLocale": { + "Locale": "de-de" + } } diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 887ea5a72..612dfab03 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -307,6 +307,7 @@ class CreateTicket < ActiveRecord::Migration t.column :content, :text, limit: 10.megabytes + 1, null: false t.column :note, :string, limit: 250, null: true t.column :active, :boolean, null: false, default: true + t.column :foreign_id, :integer, null: true t.column :updated_by_id, :integer, null: false t.column :created_by_id, :integer, null: false t.timestamps null: false diff --git a/db/migrate/20160725000001_update_text_module.rb b/db/migrate/20160725000001_update_text_module.rb new file mode 100644 index 000000000..ccb395728 --- /dev/null +++ b/db/migrate/20160725000001_update_text_module.rb @@ -0,0 +1,9 @@ +class UpdateTextModule < ActiveRecord::Migration + def up + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + add_column :text_modules, :foreign_id, :integer, null: true + + end +end diff --git a/test/unit/auto_wizard_test.rb b/test/unit/auto_wizard_test.rb index 8f8f5c003..1c64d49d9 100644 --- a/test/unit/auto_wizard_test.rb +++ b/test/unit/auto_wizard_test.rb @@ -159,6 +159,12 @@ class AutoWizardTest < ActiveSupport::TestCase email: 'zammad@localhost', } ], + TextModuleLocale: { + Locale: 'de-de', + }, + CalendarSetup: { + Ip: '195.65.29.254', + }, } assert_equal(false, AutoWizard.enabled?) auto_wizard_file_write(auto_wizard_data) @@ -166,6 +172,11 @@ class AutoWizardTest < ActiveSupport::TestCase AutoWizard.setup assert_equal(false, AutoWizard.enabled?) + assert_not_equal(0, TextModule.count) + assert_equal(1, Calendar.count) + assert_equal('Switzerland', Calendar.first.name) + assert_equal('Europe/Zurich', Calendar.first.timezone) + auto_wizard_data[:Users].each { |local_user| user = User.find_by(login: local_user[:login]) assert_equal(local_user[:login], user.login)