22 lines
575 B
Ruby
22 lines
575 B
Ruby
|
# frozen_string_literal: true
|
||
|
require 'test_helper'
|
||
|
|
||
|
class FtpConfigTest < ActiveSupport::TestCase
|
||
|
test 'should write new password file' do
|
||
|
config = FtpConfig.new
|
||
|
config.build_password_list Account.all
|
||
|
|
||
|
assert_match "#{accounts(:account2).username}:", File.read(AppConfig.htpasswd)
|
||
|
end
|
||
|
|
||
|
test 'should build user config files' do
|
||
|
config = FtpConfig.new
|
||
|
config.build_user_configs Account.all
|
||
|
|
||
|
account = accounts(:account1)
|
||
|
fconfig = File.read("#{AppConfig.ftpusers}#{account.username}")
|
||
|
|
||
|
assert_match account.home_folder, fconfig
|
||
|
end
|
||
|
end
|