Improved auto wizard test.

This commit is contained in:
Martin Edenhofer 2016-07-25 22:29:10 +02:00
parent 1b907f0d73
commit 645e421daf
5 changed files with 28 additions and 1 deletions

View file

@ -3,6 +3,9 @@
"CalendarSetup": {
"Ip": "195.65.29.254"
},
"TextModuleLocale": {
"Locale": "en-us"
},
"Users": [
{
"login": "hans.atila@zammad.org",

View file

@ -66,5 +66,8 @@
"name": "product_name",
"value": "Zammad Test System"
}
]
],
"TextModuleLocale": {
"Locale": "de-de"
}
}

View file

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

View file

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

View file

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