Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Martin Edenhofer 2015-04-27 15:06:51 +02:00
commit 4a669df039
33 changed files with 379 additions and 379 deletions

View file

@ -9,9 +9,9 @@ class AgentTicketActionLevel5Test < TestCase
signature_body1 = "--\nsig body 1 äöüß " + suffix
signature_name2 = 'sig name 2 äöüß ' + suffix
signature_body2 = "--\nsig body 2 äöüß " + suffix
group_name1 = "group name 1 " + suffix
group_name2 = "group name 2 " + suffix
group_name3 = "group name 3 " + suffix
group_name1 = 'group name 1 ' + suffix
group_name2 = 'group name 2 ' + suffix
group_name3 = 'group name 3 ' + suffix
@browser = browser_instance
login(

View file

@ -1,4 +1,4 @@
ENV["RAILS_ENV"] = "test"
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'selenium-webdriver'
@ -94,7 +94,7 @@ class TestCase < Test::Unit::TestCase
element = instance.find_elements( { :css => '#login input[name="username"]' } )[0]
if !element
raise "No login box found"
raise 'No login box found'
end
element.clear
element.send_keys( params[:username] )
@ -111,9 +111,9 @@ class TestCase < Test::Unit::TestCase
sleep 4
login = instance.find_elements( { :css => '.user-menu .user a' } )[0].attribute('title')
if login != params[:username]
raise "login failed"
raise 'login failed'
end
assert( true, "login ok" )
assert( true, 'login ok' )
login
end
@ -137,11 +137,11 @@ class TestCase < Test::Unit::TestCase
sleep 1
login = instance.find_elements( { :css => '#login' } )[0]
if login
assert( true, "logout ok" )
assert( true, 'logout ok' )
return
end
}
raise "no login box found, seems logout was not successfully!"
raise 'no login box found, seems logout was not successfully!'
end
=begin
@ -632,10 +632,10 @@ puts "tv #{params.inspect}"
is_modified = instance.find_elements( { :css => '.tasks .active .icon.modified' } )[0]
puts "m #{data[:modified].inspect}"
if exists
puts " ecists"
puts ' ecists'
end
if is_modified
puts " is_modified"
puts ' is_modified'
end
if data[:modified] == true
if is_modified
@ -804,7 +804,7 @@ wait untill text in selector disabppears
(1..loops).each { |loop|
element = instance.find_elements( { :css => params[:css] } )[0]
if !element #|| element.displayed?
assert( true, "not found" )
assert( true, 'not found' )
sleep 1
return true
end
@ -865,7 +865,7 @@ wait untill text in selector disabppears
end
end
sleep 1
assert( true, "all tasks closed" )
assert( true, 'all tasks closed' )
end
=begin
@ -926,7 +926,7 @@ wait untill text in selector disabppears
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert( true, "overview created" )
assert( true, 'overview created' )
overview = {
:name => name,
}
@ -934,7 +934,7 @@ wait untill text in selector disabppears
end
sleep 1
}
raise "overview creation failed"
raise 'overview creation failed'
end
=begin
@ -968,7 +968,7 @@ wait untill text in selector disabppears
instance.find_elements( { :css => 'a[href="#ticket/create"]' } )[0].click
element = instance.find_elements( { :css => '.active .newTicket' } )[0]
if !element
raise "no ticket create screen found!"
raise 'no ticket create screen found!'
end
sleep 1
@ -1034,7 +1034,7 @@ wait untill text in selector disabppears
end
if params[:do_not_submit]
assert( true, "ticket created without submit" )
assert( true, 'ticket created without submit' )
return
end
sleep 0.8
@ -1043,11 +1043,11 @@ wait untill text in selector disabppears
sleep 1
(1..8).each {|loop|
if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/
assert( true, "ticket created" )
assert( true, 'ticket created' )
sleep 2.5
id = instance.current_url
id.gsub!(//, )
id.gsub!(/^.+?\/(\d+)$/, "\\1")
id.gsub!(/^.+?\/(\d+)$/, '\\1')
element = instance.find_elements( { :css => '.active .page-header .ticket-number' } )[0]
if element
@ -1211,12 +1211,12 @@ wait untill text in selector disabppears
end
}
if !found
raise "no discard message found"
raise 'no discard message found'
end
end
if params[:do_not_submit]
assert( true, "ticket updated without submit" )
assert( true, 'ticket updated without submit' )
return true
end
@ -1233,7 +1233,7 @@ wait untill text in selector disabppears
end
sleep 1
}
raise "unable to update ticket"
raise 'unable to update ticket'
end
=begin
@ -1332,7 +1332,7 @@ wait untill text in selector disabppears
sleep 0.5
text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value')
if !text
raise "#global-search is not empty!"
raise '#global-search is not empty!'
end
# search by number again
@ -1375,7 +1375,7 @@ wait untill text in selector disabppears
overviews = {}
instance.find_elements( { :css => '.content.active .sidebar a[href]' } ).each {|element|
url = element.attribute('href')
url.gsub!(/(http|https):\/\/.+?\/(.+?)$/, "\\2")
url.gsub!(/(http|https):\/\/.+?\/(.+?)$/, '\\2')
overviews[url] = 0
#puts url.inspect
#puts element.inspect
@ -1411,7 +1411,7 @@ wait untill text in selector disabppears
sleep 0.5
text = instance.find_elements( { :css => '#global-search' } )[0].attribute('value')
if !text
raise "#global-search is not empty!"
raise '#global-search is not empty!'
end
element = instance.find_elements( { :css => '#global-search' } )[0]
element.click
@ -1514,7 +1514,7 @@ wait untill text in selector disabppears
:value => data[:lastname],
)
assert( true, "user created" )
assert( true, 'user created' )
end
=begin
@ -1551,12 +1551,12 @@ wait untill text in selector disabppears
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert( true, "sla created" )
assert( true, 'sla created' )
return true
end
sleep 1
}
raise "sla creation failed"
raise 'sla creation failed'
end
=begin
@ -1597,12 +1597,12 @@ wait untill text in selector disabppears
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert( true, "text module created" )
assert( true, 'text module created' )
return true
end
sleep 1
}
raise "text module creation failed"
raise 'text module creation failed'
end
=begin
@ -1640,12 +1640,12 @@ wait untill text in selector disabppears
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert( true, "signature created" )
assert( true, 'signature created' )
return true
end
sleep 1
}
raise "signature creation failed"
raise 'signature creation failed'
end
=begin
@ -1691,7 +1691,7 @@ wait untill text in selector disabppears
element = instance.find_elements( { :css => 'body' } )[0]
text = element.text
if text =~ /#{Regexp.quote(data[:name])}/
assert( true, "group created" )
assert( true, 'group created' )
# add member
if data[:member]
@ -1715,7 +1715,7 @@ wait untill text in selector disabppears
sleep 1
return true
}
raise "group creation failed"
raise 'group creation failed'
end
def quote(string)

View file

@ -163,7 +163,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
sleep 1
ticket2 = Ticket.create(
:title => "something else",
:title => 'something else',
:group => Group.lookup( :name => 'Users'),
:customer_id => customer2.id,
:state => Ticket::State.lookup( :name => 'open' ),
@ -189,7 +189,7 @@ class ElasticsearchTest < ActiveSupport::TestCase
sleep 1
ticket3 = Ticket.create(
:title => "something else",
:title => 'something else',
:group => Group.lookup( :name => 'WithoutAccess'),
:customer_id => customer3.id,
:state => Ticket::State.lookup( :name => 'open' ),

View file

@ -10,9 +10,9 @@ class OtrsImportTest < ActiveSupport::TestCase
raise "ERROR: Need IMPORT_OTRS_ENDPOINT_KEY - hint IMPORT_OTRS_ENDPOINT_KEY='01234567899876543210'"
end
Setting.set("import_otrs_endpoint", ENV['IMPORT_OTRS_ENDPOINT'])
Setting.set("import_otrs_endpoint_key", ENV['IMPORT_OTRS_ENDPOINT_KEY'])
Setting.set("import_mode", true)
Setting.set('import_otrs_endpoint', ENV['IMPORT_OTRS_ENDPOINT'])
Setting.set('import_otrs_endpoint_key', ENV['IMPORT_OTRS_ENDPOINT_KEY'])
Setting.set('import_mode', true)
Import::OTRS2.start
# check settings items
@ -24,7 +24,7 @@ class OtrsImportTest < ActiveSupport::TestCase
http = $1
fqdn = $2
system_id = $3
system_id.gsub!(/[A-z]/, "") # strip chars
system_id.gsub!(/[A-z]/, '') # strip chars
end
assert_equal( system_id, Setting.get('system_id'), 'system_id' )
assert_equal( fqdn, Setting.get('fqdn'), 'fqdn' )

View file

@ -79,7 +79,7 @@ class TwitterTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "outbound ticket created" )
assert( ticket, 'outbound ticket created' )
article = Ticket::Article.create(
:ticket_id => ticket.id,
:type_id => Ticket::Article::Type.where( :name => 'twitter status' ).first.id,
@ -92,7 +92,7 @@ class TwitterTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( article, "outbound article created" )
assert( article, 'outbound article created' )
assert_equal( article.ticket.articles.count, 1 )
sleep 10
@ -103,7 +103,7 @@ class TwitterTest < ActiveSupport::TestCase
config.access_token = user2_token
config.access_token_secret = user2_token_secret
end
client.search(hash, :count => 50, :result_type => "recent").collect do |tweet|
client.search(hash, :count => 50, :result_type => 'recent').collect do |tweet|
assert_equal( tweet.id, article.message_id )
end
@ -173,16 +173,16 @@ class TwitterTest < ActiveSupport::TestCase
# check if ticket and article has been created
article = Ticket::Article.where( :message_id => dm.id ).last
}
puts "----------------------------------------"
puts "DM: " + dm.inspect
puts "AT: " + article.inspect
puts "----------------------------------------"
puts '----------------------------------------'
puts 'DM: ' + dm.inspect
puts 'AT: ' + article.inspect
puts '----------------------------------------'
assert( article, "inbound article created" )
assert( article, 'inbound article created' )
# ticket = Ticket.find( article.ticket.id )
ticket = article.ticket
assert( ticket, "ticket of inbound article exists" )
assert( ticket.articles, "ticket.articles exists" )
assert( ticket, 'ticket of inbound article exists' )
assert( ticket.articles, 'ticket.articles exists' )
article_count = ticket.articles.count
assert( article_count )
# assert_equal( ticket.state.name, 'new' )
@ -199,7 +199,7 @@ class TwitterTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( outbound_article, "outbound article created" )
assert( outbound_article, 'outbound article created' )
assert_equal( outbound_article.ticket.articles.count, article_count + 1 )
sleep 10

View file

@ -302,7 +302,7 @@ class UserAgentTest < ActiveSupport::TestCase
# ftp / 200
result = UserAgent.request(
"ftp://ftp.gwdg.de/msgs/banner.msg",
'ftp://ftp.gwdg.de/msgs/banner.msg',
)
assert(result)
assert_equal(true, result.success?)
@ -312,7 +312,7 @@ class UserAgentTest < ActiveSupport::TestCase
# ftp / 401
result = UserAgent.request(
"ftp://ftp.gwdg.de/msgs/not_existing.msg",
'ftp://ftp.gwdg.de/msgs/not_existing.msg',
)
assert(result)
assert_equal(false, result.success?)
@ -321,7 +321,7 @@ class UserAgentTest < ActiveSupport::TestCase
# get / 200 / gzip
result = UserAgent.request(
"https://httpbin.org/gzip",
'https://httpbin.org/gzip',
)
assert(result)
assert_equal(true, result.success?)
@ -331,7 +331,7 @@ class UserAgentTest < ActiveSupport::TestCase
# get / 200 / gzip
result = UserAgent.request(
"http://httpbin.org/gzip",
'http://httpbin.org/gzip',
)
assert(result)
assert_equal(true, result.success?)
@ -341,7 +341,7 @@ class UserAgentTest < ActiveSupport::TestCase
# get / 200 / gzip
result = UserAgent.request(
"https://httpbin.org/deflate",
'https://httpbin.org/deflate',
)
assert(result)
assert_equal(true, result.success?)
@ -351,7 +351,7 @@ class UserAgentTest < ActiveSupport::TestCase
# get / 200 / gzip
result = UserAgent.request(
"http://httpbin.org/deflate",
'http://httpbin.org/deflate',
)
assert(result)
assert_equal(true, result.success?)
@ -367,7 +367,7 @@ class UserAgentTest < ActiveSupport::TestCase
# get / 0
result = UserAgent.request(
"http://not.existing.host/test.php",
'http://not.existing.host/test.php',
)
assert(result)
assert_equal(false, result.success?)
@ -376,7 +376,7 @@ class UserAgentTest < ActiveSupport::TestCase
# ftp / 0
result = UserAgent.request(
"ftp://not.existing.host/test.bin",
'ftp://not.existing.host/test.bin',
)
assert(result)
assert_equal(false, result.success?)

View file

@ -1,4 +1,4 @@
ENV["RAILS_ENV"] = "test"
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'cache'

View file

@ -1,4 +1,4 @@
ENV["RAILS_ENV"] = "test"
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'cache'

View file

@ -1,4 +1,4 @@
ENV["RAILS_ENV"] = "test"
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'test/unit'
@ -17,32 +17,32 @@ class ExampleTest < Test::Unit::TestCase
end
def test_first_page
browser.get "http://portal.znuny.com/"
assert_equal browser.current_url, "https://portal.znuny.com/#login"
browser.get 'http://portal.znuny.com/'
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
end
def test_login_failed
browser.get "http://portal.znuny.com/"
element_username = browser.find_element :name => "username"
element_username.send_keys "roy@kaldung.de"
element_password = browser.find_element :name => "password"
element_password.send_keys "123456"
browser.get 'http://portal.znuny.com/'
element_username = browser.find_element :name => 'username'
element_username.send_keys 'roy@kaldung.de'
element_password = browser.find_element :name => 'password'
element_password.send_keys '123456'
element_password.submit
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { browser.find_element(:id => "app") }
assert_equal browser.current_url, "https://portal.znuny.com/#login"
wait.until { browser.find_element(:id => 'app') }
assert_equal browser.current_url, 'https://portal.znuny.com/#login'
end
def test_login_passed
browser.get "http://portal.znuny.com/"
element_username = browser.find_element :name => "username"
element_username.send_keys "roy@kaldung.com"
element_password = browser.find_element :name => "password"
element_password.send_keys "090504"
browser.get 'http://portal.znuny.com/'
element_username = browser.find_element :name => 'username'
element_username.send_keys 'roy@kaldung.com'
element_password = browser.find_element :name => 'password'
element_password.send_keys '090504'
element_password.submit
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until { browser.find_element(:id => "app") }
assert_equal browser.current_url, "https://portal.znuny.com/#ticket_view/my_tickets"
wait.until { browser.find_element(:id => 'app') }
assert_equal browser.current_url, 'https://portal.znuny.com/#ticket_view/my_tickets'
end
end

View file

@ -71,7 +71,7 @@ class AaaStringTest < ActiveSupport::TestCase
result = "test\ntest"
assert_equal( result, html.html2text )
html = "<table><tr><td>test</td><td>col</td></td></tr><tr><td>test</td><td>4711</td></tr></table>"
html = '<table><tr><td>test</td><td>col</td></td></tr><tr><td>test</td><td>4711</td></tr></table>'
result = "test col \ntest 4711"
assert_equal( result, html.html2text )

View file

@ -142,7 +142,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
ticket_id = ticket.id
ticket.destroy
found = Ticket.where( :id => ticket_id ).first
assert( !found, "Ticket destroyed")
assert( !found, 'Ticket destroyed')
}
end
@ -217,7 +217,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
organization_id = organization.id
organization.destroy
found = Organization.where( :id => organization_id ).first
assert( !found, "Organization destroyed")
assert( !found, 'Organization destroyed')
}
end
@ -284,7 +284,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
user_id = user.id
user.destroy
found = User.where( :id => user_id ).first
assert( !found, "User destroyed")
assert( !found, 'User destroyed')
}
end
@ -363,7 +363,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
user_id = user.id
user.destroy
found = User.where( :id => user_id ).first
assert( !found, "User destroyed")
assert( !found, 'User destroyed')
}
end

View file

@ -298,7 +298,7 @@ Hof
:params => {
:from => '"Müller, Bernd" <Bernd.Mueller@example.com>',
:from_email => 'Bernd.Mueller@example.com',
:from_display_name => "Müller, Bernd",
:from_display_name => 'Müller, Bernd',
:subject => 'AW: OTRS [Ticket#118192]',
:to => '\'Martin Edenhofer via Znuny Sales\' <sales@znuny.com>',
},
@ -318,7 +318,7 @@ Hof
:params => {
:from => '"Sara.Gang" <ynbe.ctrhk@gmail.com>',
:from_email => 'ynbe.ctrhk@gmail.com',
:from_display_name => "Sara.Gang",
:from_display_name => 'Sara.Gang',
:subject => '绩效管理,究竟谁错了',
:to => 'info42@znuny.com',
},
@ -330,7 +330,7 @@ Hof
:params => {
:from => nil,
:from_email => 'vipyimin@126.com',
:from_display_name => "",
:from_display_name => '',
:subject => '【 直通美国排名第49大学 成功后付费 】',
:to => '"enterprisemobility.apacservice" <enterprisemobility.apacservice@motorola.com>',
},
@ -342,7 +342,7 @@ Hof
:params => {
:from => '"都琹" <ghgbwum@185.com.cn>',
:from_email => 'ghgbwum@185.com.cn',
:from_display_name => "都琹",
:from_display_name => '都琹',
:subject => '【专业为您注册香港及海外公司(好处多多)】                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               人物 互联网事百度新闻独家出品传媒换一批捷克戴维斯杯决赛前任命临时领队 前领队因病住院最新:盖世汽车讯 11月6日通用汽车宣布今年10月份在华销量...减持三特索道 孟凯将全力发展湘鄂情江青摄影作品科技日报讯 (记者过国忠 通讯员陈飞燕)江苏省无线电科学研究所有限公司院士工作站日前正式建...[详细]',
:to => 'info@znuny.com',
},
@ -534,10 +534,10 @@ gate GmbH * Gladbacher Str. 74 * 40219 Düsseldorf
:params => {
:from => 'caoyaoewfzfw@21cn.com',
:from_email => 'caoyaoewfzfw@21cn.com',
:from_display_name => "",
:from_display_name => '',
:subject => "\r\n蠭龕中層管理者如何避免角色行为誤区",
:to => 'duan@seat.com.cn, info@znuny.com, jinzh@kingdream.com',
:body => "",
:body => '',
},
:attachments => [
{
@ -552,10 +552,10 @@ gate GmbH * Gladbacher Str. 74 * 40219 Düsseldorf
:params => {
:from => 'kontakt@example.de',
:from_email => 'kontakt@example.de',
:from_display_name => "",
:subject => "Bewerbung auf Ihr Stellenangebot",
:from_display_name => '',
:subject => 'Bewerbung auf Ihr Stellenangebot',
:to => 'info@znuny.inc',
:body => "no visible content",
:body => 'no visible content',
},
:attachments => [
{
@ -574,8 +574,8 @@ gate GmbH * Gladbacher Str. 74 * 40219 Düsseldorf
:params => {
:from => 'Example Sales <sales@example.com>',
:from_email => 'sales@example.com',
:from_display_name => "Example Sales",
:subject => "Example licensing information: No channel available",
:from_display_name => 'Example Sales',
:subject => 'Example licensing information: No channel available',
:to => 'info@znuny.inc',
:body => "Dear Mr. Edenhofer,We want to keep you updated on TeamViewer licensing shortages on a regular basis.
We would like to inform you that since the last message on 25-Nov-2014 there have been temporary session channel exceedances which make it impossible to establish more sessions. Since the last e-mail this has occurred in a total of 1 cases.
@ -604,8 +604,8 @@ Registration AG Ulm HRB 534075 * General Manager Holger Felgner
:params => {
:from => 'Manfred Haert <Manfred.Haert@example.com>',
:from_email => 'Manfred.Haert@example.com',
:from_display_name => "Manfred Haert",
:subject => "Antragswesen in TesT abbilden",
:from_display_name => 'Manfred Haert',
:subject => 'Antragswesen in TesT abbilden',
:to => 'info@znuny.inc',
:body => "Sehr geehrte Damen undHerren,
@ -649,8 +649,8 @@ Weil wir die Echtheit oder Vollständigkeit der in dieserNachricht enthaltenen I
:params => {
:from => '"bertha mou" <zhengkang@ha.chinamobile.com>',
:from_email => 'zhengkang@ha.chinamobile.com',
:from_display_name => "bertha mou",
:subject => "內應力產生与注塑工艺条件之间的关系;",
:from_display_name => 'bertha mou',
:subject => '內應力產生与注塑工艺条件之间的关系;',
:to => 'info@znuny.inc',
},
},
@ -660,8 +660,8 @@ Weil wir die Echtheit oder Vollständigkeit der in dieserNachricht enthaltenen I
:params => {
:from => '"Dana.Qin" <Dana.Qin6e1@gmail.com>',
:from_email => 'Dana.Qin6e1@gmail.com',
:from_display_name => "Dana.Qin",
:subject => "发现最美车间主任",
:from_display_name => 'Dana.Qin',
:subject => '发现最美车间主任',
:to => 'info@znuny.inc',
},
},

View file

@ -39,7 +39,7 @@ Some Textäöü",
To: customer@example.com
Subject: äöü some subject
Some Textäöü".encode("ISO-8859-1"),
Some Textäöü".encode('ISO-8859-1'),
:success => true,
:result => {
0 => {

View file

@ -189,7 +189,7 @@ class HistoryTest < ActiveSupport::TestCase
ticket_id = ticket.id
ticket.destroy
found = Ticket.where( :id => ticket_id ).first
assert( !found, "Ticket destroyed")
assert( !found, 'Ticket destroyed')
}
end
@ -280,7 +280,7 @@ class HistoryTest < ActiveSupport::TestCase
user_id = user.id
user.destroy
found = User.where( :id => user_id ).first
assert( !found, "User destroyed")
assert( !found, 'User destroyed')
}
end
@ -349,7 +349,7 @@ class HistoryTest < ActiveSupport::TestCase
organization_id = organization.id
organization.destroy
found = Organization.where( :id => organization_id ).first
assert( !found, "Organization destroyed")
assert( !found, 'Organization destroyed')
}
end

View file

@ -152,7 +152,7 @@ class NotificationFactoryTest < ActiveSupport::TestCase
},
:locale => test[:locale]
)
assert_equal( test[:result], result, "verify result" )
assert_equal( test[:result], result, 'verify result' )
}
ticket.destroy
@ -207,7 +207,7 @@ next line, Group: Users',
},
:locale => test[:locale]
)
assert_equal( test[:result], result, "verify result" )
assert_equal( test[:result], result, 'verify result' )
}
ticket.destroy
@ -288,7 +288,7 @@ next line, Group: Users',
},
:locale => test[:locale]
)
assert_equal( test[:result], result, "verify result" )
assert_equal( test[:result], result, 'verify result' )
}
ticket.destroy

View file

@ -258,10 +258,10 @@ class OnlineNotificationTest < ActiveSupport::TestCase
if test[:create][:online_notification]
if test[:create][:online_notification][:seen_only_exists]
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
assert( notification_seen_only_exists_exists( notifications ), "not seen notifications for ticket available")
assert( notification_seen_only_exists_exists( notifications ), 'not seen notifications for ticket available')
else
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
assert( !notification_seen_only_exists_exists( notifications ), "seen notifications for ticket available")
assert( !notification_seen_only_exists_exists( notifications ), 'seen notifications for ticket available')
end
end
@ -285,10 +285,10 @@ class OnlineNotificationTest < ActiveSupport::TestCase
if test[:update][:online_notification]
if test[:update][:online_notification][:seen_only_exists]
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
assert( notification_seen_only_exists_exists( notifications ), "not seen notifications for ticket available")
assert( notification_seen_only_exists_exists( notifications ), 'not seen notifications for ticket available')
else
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
assert( !notification_seen_only_exists_exists( notifications ), "seen notifications for ticket available")
assert( !notification_seen_only_exists_exists( notifications ), 'seen notifications for ticket available')
end
end
}
@ -299,23 +299,23 @@ class OnlineNotificationTest < ActiveSupport::TestCase
:user_id => 1,
)
notifications = OnlineNotification.list_by_object( 'Ticket', tickets[2].id )
assert( !notifications.empty?, "should have notifications")
assert( notification_seen_only_exists_exists(notifications), "still not seen notifications for merged ticket available")
assert( !notifications.empty?, 'should have notifications')
assert( notification_seen_only_exists_exists(notifications), 'still not seen notifications for merged ticket available')
notifications = OnlineNotification.list_by_object( 'Ticket', tickets[3].id )
assert( !notifications.empty?, "should have notifications")
assert( !notification_seen_only_exists_exists(notifications), "no notifications for master ticket available")
assert( !notifications.empty?, 'should have notifications')
assert( !notification_seen_only_exists_exists(notifications), 'no notifications for master ticket available')
# delete tickets
tickets.each { |ticket|
ticket_id = ticket.id
ticket.destroy
found = Ticket.where( :id => ticket_id ).first
assert( !found, "Ticket destroyed")
assert( !found, 'Ticket destroyed')
# check if notifications for ticket still exist
notifications = OnlineNotification.list_by_object( 'Ticket', ticket_id )
assert( notifications.empty?, "still notifications for destroyed ticket available")
assert( notifications.empty?, 'still notifications for destroyed ticket available')
}
end

View file

@ -71,7 +71,7 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.customer.id, customer1.id )
assert_equal( ticket.organization.id, organization1.id )
@ -83,16 +83,16 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
# check if ticket and customer has been touched
ticket = Ticket.find(ticket.id)
if ticket.updated_at > 2.second.ago
assert( true, "ticket.updated_at has been updated" )
assert( true, 'ticket.updated_at has been updated' )
else
assert( false, "ticket.updated_at has not been updated" )
assert( false, 'ticket.updated_at has not been updated' )
end
customer1 = User.find(customer1.id)
if customer1.updated_at > 2.second.ago
assert( true, "customer1.updated_at has been updated" )
assert( true, 'customer1.updated_at has been updated' )
else
assert( false, "customer1.updated_at has not been updated" )
assert( false, 'customer1.updated_at has not been updated' )
end
sleep 4
@ -103,19 +103,19 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
# check if customer1 and organization has been touched
customer1 = User.find(customer1.id)
if customer1.updated_at > 2.second.ago
assert( true, "customer1.updated_at has been updated" )
assert( true, 'customer1.updated_at has been updated' )
else
assert( false, "customer1.updated_at has not been updated" )
assert( false, 'customer1.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( true, "organization1.updated_at has been updated" )
assert( true, 'organization1.updated_at has been updated' )
else
assert( false, "organization1.updated_at has not been updated" )
assert( false, 'organization1.updated_at has not been updated' )
end
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
end
end

View file

@ -234,9 +234,9 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k</file>
success = false
end
if test[:result]
assert( success, "install package not successful" )
assert( success, 'install package not successful' )
else
assert( !success, "install package successful but should not" )
assert( !success, 'install package successful but should not' )
end
elsif test[:action] == 'uninstall'
if test[:zpm]
@ -253,9 +253,9 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k</file>
end
end
if test[:result]
assert( success, "uninstall package not successful" )
assert( success, 'uninstall package not successful' )
else
assert( !success, "uninstall package successful but should not" )
assert( !success, 'uninstall package successful but should not' )
end
elsif test[:action] == 'auto_install'
if test[:zpm]

View file

@ -14,7 +14,7 @@ class RecentViewTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket1, "ticket created" )
assert( ticket1, 'ticket created' )
ticket2 = Ticket.create(
:title => 'RecentViewTest 2 some title äöüß',
:group => Group.lookup( :name => 'Users'),
@ -24,7 +24,7 @@ class RecentViewTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket2, "ticket created" )
assert( ticket2, 'ticket created' )
user1 = User.find(2)
RecentView.user_log_destroy(user1)
@ -121,7 +121,7 @@ class RecentViewTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket1, "ticket created" )
assert( ticket1, 'ticket created' )
# log entry of not existing object
RecentView.user_log_destroy(customer)
@ -150,7 +150,7 @@ class RecentViewTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket1, "ticket created" )
assert( ticket1, 'ticket created' )
# log entry
RecentView.user_log_destroy(customer)

View file

@ -6,7 +6,7 @@ class RestTest < ActiveSupport::TestCase
test 'users and orgs' do
if !ENV['BROWSER_URL']
puts "NOTICE: Do not execute rest tests, no BROWSER_URL=http://some_host:port is defined! e. g. export BROWSER_URL=http://localhost:3000"
puts 'NOTICE: Do not execute rest tests, no BROWSER_URL=http://some_host:port is defined! e. g. export BROWSER_URL=http://localhost:3000'
return
end

View file

@ -5,44 +5,44 @@ class SessionBasicTest < ActiveSupport::TestCase
test 'a cache' do
Sessions::CacheIn.set( 'last_run_test' , true, { :expires_in => 2.seconds } )
result = Sessions::CacheIn.get( 'last_run_test' )
assert_equal( true, result, "check 1" )
assert_equal( true, result, 'check 1' )
# should not be expired
result = Sessions::CacheIn.expired( 'last_run_test' )
assert_equal( false, result, "check 1 - expired" )
assert_equal( false, result, 'check 1 - expired' )
# should be expired
sleep 3
result = Sessions::CacheIn.expired( 'last_run_test' )
assert_equal( true, result, "check 1 - expired" )
assert_equal( true, result, 'check 1 - expired' )
# renew expire
result = Sessions::CacheIn.get( 'last_run_test', :re_expire => true )
assert_equal( true, result, "check 1 - re_expire" )
assert_equal( true, result, 'check 1 - re_expire' )
# should not be expired
result = Sessions::CacheIn.expired( 'last_run_test' )
assert_equal( false, result, "check 1 - expired" )
assert_equal( false, result, 'check 1 - expired' )
# ignore expired
sleep 3
result = Sessions::CacheIn.get( 'last_run_test', :ignore_expire => true )
assert_equal( true, result, "check 1 - ignore_expire" )
assert_equal( true, result, 'check 1 - ignore_expire' )
# should be expired
result = Sessions::CacheIn.expired( 'last_run_test' )
assert_equal( true, result, "check 2" )
assert_equal( true, result, 'check 2' )
result = Sessions::CacheIn.get( 'last_run_test' )
assert_equal( nil, result, "check 2" )
assert_equal( nil, result, 'check 2' )
# check delete cache
Sessions::CacheIn.set( 'last_run_delete' , true, { :expires_in => 5.seconds } )
result = Sessions::CacheIn.get( 'last_run_delete' )
assert_equal( true, result, "check 1" )
assert_equal( true, result, 'check 1' )
Sessions::CacheIn.delete( 'last_run_delete' )
result = Sessions::CacheIn.get( 'last_run_delete' )
assert_equal( nil, nil, "check delete" )
assert_equal( nil, nil, 'check delete' )
end
test 'b collections group' do
@ -55,18 +55,18 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections" )
assert( !result1.empty?, 'check collections' )
sleep 0.6
result2 = collection_client2.push
assert( !result2.empty?, "check collections" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections' )
assert_equal( result1, result2, 'check collections' )
# next check should be empty
result1 = collection_client1.push
assert( !result1, "check collections - recall" )
assert( !result1, 'check collections - recall' )
sleep 1
result2 = collection_client2.push
assert( !result2, "check collections - recall" )
assert( !result2, 'check collections - recall' )
# change collection
group = Group.first
@ -75,17 +75,17 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections - after touch" )
assert( !result1.empty?, 'check collections - after touch' )
result2 = collection_client2.push
assert( !result2.empty?, "check collections - after touch" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections - after touch' )
assert_equal( result1, result2, 'check collections' )
# check again after touch
result1 = collection_client1.push
assert( !result1, "check collections - after touch - recall" )
assert( !result1, 'check collections - after touch - recall' )
result2 = collection_client2.push
assert( !result2, "check collections - after touch - recall" )
assert_equal( result1, result2, "check collections" )
assert( !result2, 'check collections - after touch - recall' )
assert_equal( result1, result2, 'check collections' )
# change collection
group = Group.create( :name => 'SomeGroup::' + rand(999999).to_s, :active => true )
@ -93,18 +93,18 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections - after create" )
assert( !result1.empty?, 'check collections - after create' )
result2 = collection_client2.push
assert( !result2.empty?, "check collections - after create" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections - after create' )
assert_equal( result1, result2, 'check collections' )
# check again after create
sleep 4
result1 = collection_client1.push
assert( !result1, "check collections - after create - recall" )
assert( !result1, 'check collections - after create - recall' )
result2 = collection_client2.push
assert( !result2, "check collections - after create - recall" )
assert_equal( result1, result2, "check collections" )
assert( !result2, 'check collections - after create - recall' )
assert_equal( result1, result2, 'check collections' )
# change collection
group.destroy
@ -112,18 +112,18 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections - after destroy" )
assert( !result1.empty?, 'check collections - after destroy' )
result2 = collection_client2.push
assert( !result2.empty?, "check collections - after destroy" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections - after destroy' )
assert_equal( result1, result2, 'check collections' )
# check again after destroy
sleep 4
result1 = collection_client1.push
assert( !result1, "check collections - after destroy - recall" )
assert( !result1, 'check collections - after destroy - recall' )
result2 = collection_client2.push
assert( !result2, "check collections - after destroy - recall" )
assert_equal( result1, result2, "check collections" )
assert( !result2, 'check collections - after destroy - recall' )
assert_equal( result1, result2, 'check collections' )
end
user = User.lookup(:id => 1)
@ -142,17 +142,17 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections - should be nil, no org exists!
result1 = collection_client1.push
assert( !result1.empty?, "check collections" )
assert( !result1.empty?, 'check collections' )
result2 = collection_client2.push
assert( !result2.empty?, "check collections" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections' )
assert_equal( result1, result2, 'check collections' )
# next check - should still be nil, no org exists!
result1 = collection_client1.push
assert( !result1, "check collections - recall" )
assert( !result1, 'check collections - recall' )
sleep 0.6
result2 = collection_client2.push
assert( !result2, "check collections - recall" )
assert( !result2, 'check collections - recall' )
# change collection
org = Organization.create( :name => 'SomeOrg2::' + rand(999999).to_s, :active => true )
@ -160,18 +160,18 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections - after create" )
assert( !result1.empty?, 'check collections - after create' )
result2 = collection_client2.push
assert( !result2.empty?, "check collections - after create" )
assert_equal( result1, result2, "check collections" )
assert( !result2.empty?, 'check collections - after create' )
assert_equal( result1, result2, 'check collections' )
sleep 4
# next check should be empty
result1 = collection_client1.push
assert( !result1, "check collections - after create recall" )
assert( !result1, 'check collections - after create recall' )
result2 = collection_client2.push
assert( !result2, "check collections - after create recall" )
assert( !result2, 'check collections - after create recall' )
organization = Organization.first
organization.touch
@ -179,10 +179,10 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( !result1.empty?, "check collections - after touch" )
assert( !result1.empty?, 'check collections - after touch' )
result2 = collection_client2.push
assert( !result1.empty?, "check collections - after touch" )
assert_equal( result1, result2, "check collections" )
assert( !result1.empty?, 'check collections - after touch' )
assert_equal( result1, result2, 'check collections' )
end
test 'b rss' do
@ -192,13 +192,13 @@ class SessionBasicTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
#puts "RSS1: #{result1.inspect}"
assert( !result1.empty?, "check rss" )
assert( !result1.empty?, 'check rss' )
sleep 1
# next check should be empty
result1 = collection_client1.push
#puts "R1: #{result1.inspect}"
assert( !result1, "check rss - recall" )
assert( !result1, 'check rss - recall' )
end
test 'b activity stream' do
@ -219,23 +219,23 @@ class SessionBasicTest < ActiveSupport::TestCase
:groups => groups,
)
agent1.roles = roles
assert( agent1.save, "create/update agent1" )
assert( agent1.save, 'create/update agent1' )
as_client1 = Sessions::Backend::ActivityStream.new(agent1, false, '123-1', 3)
# get as stream
result1 = as_client1.push
assert( result1, "check as agent1" )
assert( result1, 'check as agent1' )
sleep 1
# next check should be empty
result1 = as_client1.push
assert( !result1, "check as agent1 - recall" )
assert( !result1, 'check as agent1 - recall' )
# next check should be empty
sleep 4
result1 = as_client1.push
assert( !result1, "check as agent1 - recall 2" )
assert( !result1, 'check as agent1 - recall 2' )
agent1.update_attribute( :email, 'activity-stream-agent11@example.com' )
ticket = Ticket.create(:title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
@ -244,7 +244,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# get as stream
result1 = as_client1.push
assert( result1, "check as agent1 - recall 3" )
assert( result1, 'check as agent1 - recall 3' )
end
test 'b ticket_create' do
@ -255,17 +255,17 @@ class SessionBasicTest < ActiveSupport::TestCase
# get as stream
result1 = ticket_create_client1.push
assert( result1, "check ticket_create" )
assert( result1, 'check ticket_create' )
sleep 0.6
# next check should be empty
result1 = ticket_create_client1.push
assert( !result1, "check ticket_create - recall" )
assert( !result1, 'check ticket_create - recall' )
# next check should be empty
sleep 0.6
result1 = ticket_create_client1.push
assert( !result1, "check ticket_create - recall 2" )
assert( !result1, 'check ticket_create - recall 2' )
Group.create( :name => 'SomeTicketCreateGroup::' + rand(999999).to_s, :active => true )
@ -273,7 +273,7 @@ class SessionBasicTest < ActiveSupport::TestCase
# get as stream
result1 = ticket_create_client1.push
assert( result1, "check ticket_create - recall 3" )
assert( result1, 'check ticket_create - recall 3' )
end
end

View file

@ -21,23 +21,23 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
:groups => groups,
)
agent1.roles = roles
assert( agent1.save, "create/update agent1" )
assert( agent1.save, 'create/update agent1' )
user = User.lookup( :id => agent1.id )
client1 = Sessions::Backend::TicketOverviewIndex.new(user, false, '123-1', 3)
# get as stream
result1 = client1.push
assert( result1, "check ticket_overview_index" )
assert( result1, 'check ticket_overview_index' )
# next check should be empty / no changes
result1 = client1.push
assert( !result1, "check ticket_overview_index - recall" )
assert( !result1, 'check ticket_overview_index - recall' )
# next check should be empty / no changes
sleep 4
result1 = client1.push
assert( !result1, "check ticket_overview_index - recall 2" )
assert( !result1, 'check ticket_overview_index - recall 2' )
# create ticket
ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
@ -45,7 +45,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
# get as stream
result1 = client1.push
assert( result1, "check ticket_overview_index - recall 3" )
assert( result1, 'check ticket_overview_index - recall 3' )
end
test 'b ticket_overview_list' do
@ -67,7 +67,7 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
:groups => groups,
)
agent1.roles = roles
assert( agent1.save, "create/update agent1" )
assert( agent1.save, 'create/update agent1' )
user = User.lookup( :id => agent1.id )
@ -75,16 +75,16 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
# get as stream
result1 = client1.push
assert( result1, "check ticket_overview_list" )
assert( result1, 'check ticket_overview_list' )
# next check should be empty / no changes
result1 = client1.push
assert( !result1, "check ticket_overview_list - recall" )
assert( !result1, 'check ticket_overview_list - recall' )
# next check should be empty / no changes
sleep 4
result1 = client1.push
assert( !result1, "check ticket_overview_list - recall 2" )
assert( !result1, 'check ticket_overview_list - recall 2' )
# create ticket
ticket = Ticket.create( :title => '12323', :group_id => 1, :priority_id => 1, :state_id => 1, :customer_id => 1 )
@ -92,6 +92,6 @@ class SessionBasicTicketTest < ActiveSupport::TestCase
# get as stream
result1 = client1.push
assert( result1, "check ticket_overview_list - recall 3" )
assert( result1, 'check ticket_overview_list - recall 3' )
end
end

View file

@ -60,35 +60,35 @@ class SessionCollectionsTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( result1, "check collections" )
assert( check_if_collection_exists(result1, :Group), "check collections - after init" )
assert( check_if_collection_exists(result1, :Role), "check collections - after init" )
assert( check_if_collection_exists(result1, :Signature), "check collections - after init" )
assert( check_if_collection_exists(result1, :EmailAddress), "check collections - after init" )
assert( result1, 'check collections' )
assert( check_if_collection_exists(result1, :Group), 'check collections - after init' )
assert( check_if_collection_exists(result1, :Role), 'check collections - after init' )
assert( check_if_collection_exists(result1, :Signature), 'check collections - after init' )
assert( check_if_collection_exists(result1, :EmailAddress), 'check collections - after init' )
sleep 1
result2 = collection_client2.push
assert( result2, "check collections" )
assert( check_if_collection_exists(result2, :Group), "check collections - after init" )
assert( check_if_collection_exists(result2, :Role), "check collections - after init" )
assert( check_if_collection_exists(result2, :Signature), "check collections - after init" )
assert( check_if_collection_exists(result2, :EmailAddress), "check collections - after init" )
assert_equal( result1, result2, "check collections" )
assert( result2, 'check collections' )
assert( check_if_collection_exists(result2, :Group), 'check collections - after init' )
assert( check_if_collection_exists(result2, :Role), 'check collections - after init' )
assert( check_if_collection_exists(result2, :Signature), 'check collections - after init' )
assert( check_if_collection_exists(result2, :EmailAddress), 'check collections - after init' )
assert_equal( result1, result2, 'check collections' )
result3 = collection_client3.push
assert( result3, "check collections" )
assert( check_if_collection_exists(result3, :Group), "check collections - after init" )
assert( check_if_collection_exists(result3, :Role), "check collections - after init" )
assert( !check_if_collection_exists(result3, :Signature), "check collections - after init" )
assert( !check_if_collection_exists(result3, :EmailAddress), "check collections - after init" )
assert( result3, 'check collections' )
assert( check_if_collection_exists(result3, :Group), 'check collections - after init' )
assert( check_if_collection_exists(result3, :Role), 'check collections - after init' )
assert( !check_if_collection_exists(result3, :Signature), 'check collections - after init' )
assert( !check_if_collection_exists(result3, :EmailAddress), 'check collections - after init' )
# next check should be empty
result1 = collection_client1.push
assert( result1.empty?, "check collections - recall" )
assert( result1.empty?, 'check collections - recall' )
sleep 0.4
result2 = collection_client2.push
assert( result2.empty?, "check collections - recall" )
assert( result2.empty?, 'check collections - recall' )
result3 = collection_client3.push
assert( result3.empty?, "check collections - recall" )
assert( result3.empty?, 'check collections - recall' )
# change collection
group = Group.first
@ -97,15 +97,15 @@ class SessionCollectionsTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( result1, "check collections - after touch" )
assert( check_if_collection_exists(result1, :Group), "check collections - after touch" )
assert( result1, 'check collections - after touch' )
assert( check_if_collection_exists(result1, :Group), 'check collections - after touch' )
sleep 0.1
result2 = collection_client2.push
assert( result2, "check collections - after touch" )
assert( check_if_collection_exists(result2, :Group), "check collections - after touch" )
assert( result2, 'check collections - after touch' )
assert( check_if_collection_exists(result2, :Group), 'check collections - after touch' )
result3 = collection_client3.push
assert( result3, "check collections - after touch" )
assert( check_if_collection_exists(result3, :Group), "check collections - after touch" )
assert( result3, 'check collections - after touch' )
assert( check_if_collection_exists(result3, :Group), 'check collections - after touch' )
# change collection
org = Organization.create( :name => 'SomeOrg::' + rand(999999).to_s, :active => true, :member_ids => [customer1.id] )
@ -113,26 +113,26 @@ class SessionCollectionsTest < ActiveSupport::TestCase
# get whole collections
result1 = collection_client1.push
assert( result1, "check collections - after create" )
assert( check_if_collection_exists(result1, :Organization, { :id => org.id, :member_ids => [customer1.id] } ), "check collections - after create with attributes" )
assert( result1, 'check collections - after create' )
assert( check_if_collection_exists(result1, :Organization, { :id => org.id, :member_ids => [customer1.id] } ), 'check collections - after create with attributes' )
sleep 0.3
result2 = collection_client2.push
assert( result2, "check collections - after create" )
assert( check_if_collection_exists(result2, :Organization), "check collections - after create" )
assert( result2, 'check collections - after create' )
assert( check_if_collection_exists(result2, :Organization), 'check collections - after create' )
# user has no organization, so collection should be empty
result3 = collection_client3.push
assert( result3, "check collections - after create" )
assert( !check_if_collection_exists(result3, :Organization), "check collections - after create" )
assert( result3, 'check collections - after create' )
assert( !check_if_collection_exists(result3, :Organization), 'check collections - after create' )
# next check should be empty
sleep 1
result1 = collection_client1.push
assert( result1.empty?, "check collections - recall" )
assert( result1.empty?, 'check collections - recall' )
result2 = collection_client2.push
assert( result2.empty?, "check collections - recall" )
assert( result2.empty?, 'check collections - recall' )
result3 = collection_client3.push
assert( result3.empty?, "check collections - recall" )
assert( result3.empty?, 'check collections - recall' )
end
def check_if_collection_exists(results, collection, attributes = nil)

View file

@ -58,16 +58,16 @@ class SessionEnhancedTest < ActiveSupport::TestCase
Sessions.create( client_id3, agent3.attributes, { :type => 'ajax' } )
# check if session exists
assert( Sessions.session_exists?(client_id1), "check if session exists" )
assert( Sessions.session_exists?(client_id2), "check if session exists" )
assert( Sessions.session_exists?(client_id3), "check if session exists" )
assert( Sessions.session_exists?(client_id1), 'check if session exists' )
assert( Sessions.session_exists?(client_id2), 'check if session exists' )
assert( Sessions.session_exists?(client_id3), 'check if session exists' )
# check if session still exists after idle cleanup
sleep 1
Sessions.destory_idle_sessions(5)
assert( Sessions.session_exists?(client_id1), "check if session exists after 1 sec" )
assert( Sessions.session_exists?(client_id2), "check if session exists after 1 sec" )
assert( Sessions.session_exists?(client_id3), "check if session exists after 1 sec" )
assert( Sessions.session_exists?(client_id1), 'check if session exists after 1 sec' )
assert( Sessions.session_exists?(client_id2), 'check if session exists after 1 sec' )
assert( Sessions.session_exists?(client_id3), 'check if session exists after 1 sec' )
# check if session still exists after idle cleanup with touched sessions
sleep 6
@ -75,25 +75,25 @@ class SessionEnhancedTest < ActiveSupport::TestCase
Sessions.touch(client_id2)
Sessions.touch(client_id3)
Sessions.destory_idle_sessions(5)
assert( Sessions.session_exists?(client_id1), "check if session exists after touch" )
assert( Sessions.session_exists?(client_id2), "check if session exists after touch" )
assert( Sessions.session_exists?(client_id3), "check if session exists after touch" )
assert( Sessions.session_exists?(client_id1), 'check if session exists after touch' )
assert( Sessions.session_exists?(client_id2), 'check if session exists after touch' )
assert( Sessions.session_exists?(client_id3), 'check if session exists after touch' )
# check session data
data = Sessions.get(client_id1)
assert( data[:meta], "check if meta exists" )
assert( data[:user], "check if user exists" )
assert_equal( data[:user]['id'], agent1.id, "check if user id is correct" )
assert( data[:meta], 'check if meta exists' )
assert( data[:user], 'check if user exists' )
assert_equal( data[:user]['id'], agent1.id, 'check if user id is correct' )
data = Sessions.get(client_id2)
assert( data[:meta], "check if meta exists" )
assert( data[:user], "check if user exists" )
assert_equal( data[:user]['id'], agent2.id, "check if user id is correct" )
assert( data[:meta], 'check if meta exists' )
assert( data[:user], 'check if user exists' )
assert_equal( data[:user]['id'], agent2.id, 'check if user id is correct' )
data = Sessions.get(client_id3)
assert( data[:meta], "check if meta exists" )
assert( data[:user], "check if user exists" )
assert_equal( data[:user]['id'], agent3.id, "check if user id is correct" )
assert( data[:meta], 'check if meta exists' )
assert( data[:user], 'check if user exists' )
assert_equal( data[:user]['id'], agent3.id, 'check if user id is correct' )
# send data to one client
Sessions.send( client_id1, { :msg => 'äöüß123' } )
@ -150,25 +150,25 @@ class SessionEnhancedTest < ActiveSupport::TestCase
#jobs.join
# check client threads
assert( Sessions.thread_client_exists?(client_id1), "check if client is running" )
assert( Sessions.thread_client_exists?(client_id2), "check if client is running" )
assert( Sessions.thread_client_exists?(client_id3), "check if client is running" )
assert( Sessions.thread_client_exists?(client_id1), 'check if client is running' )
assert( Sessions.thread_client_exists?(client_id2), 'check if client is running' )
assert( Sessions.thread_client_exists?(client_id3), 'check if client is running' )
# check if session still exists after idle cleanup
sleep 6
client_ids = Sessions.destory_idle_sessions(5)
# check client sessions
assert( !Sessions.session_exists?(client_id1), "check if session is removed" )
assert( !Sessions.session_exists?(client_id2), "check if session is removed" )
assert( !Sessions.session_exists?(client_id3), "check if session is removed" )
assert( !Sessions.session_exists?(client_id1), 'check if session is removed' )
assert( !Sessions.session_exists?(client_id2), 'check if session is removed' )
assert( !Sessions.session_exists?(client_id3), 'check if session is removed' )
sleep 6
# check client threads
assert( !Sessions.thread_client_exists?(client_id1), "check if client is running" )
assert( !Sessions.thread_client_exists?(client_id2), "check if client is running" )
assert( !Sessions.thread_client_exists?(client_id3), "check if client is running" )
assert( !Sessions.thread_client_exists?(client_id1), 'check if client is running' )
assert( !Sessions.thread_client_exists?(client_id2), 'check if client is running' )
assert( !Sessions.thread_client_exists?(client_id3), 'check if client is running' )
# exit jobs
jobs.exit
@ -227,9 +227,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
Sessions.create( client_id2, agent2.attributes, { :type => 'ajax' } )
# check if session exists
assert( Sessions.session_exists?(client_id1_0), "check if session exists" )
assert( Sessions.session_exists?(client_id1_1), "check if session exists" )
assert( Sessions.session_exists?(client_id2), "check if session exists" )
assert( Sessions.session_exists?(client_id1_0), 'check if session exists' )
assert( Sessions.session_exists?(client_id1_1), 'check if session exists' )
assert( Sessions.session_exists?(client_id2), 'check if session exists' )
sleep 11
# check collections
@ -283,9 +283,9 @@ class SessionEnhancedTest < ActiveSupport::TestCase
client_ids = Sessions.destory_idle_sessions(5)
# check client sessions
assert( !Sessions.session_exists?(client_id1_0), "check if session is removed" )
assert( !Sessions.session_exists?(client_id1_1), "check if session is removed" )
assert( !Sessions.session_exists?(client_id2), "check if session is removed" )
assert( !Sessions.session_exists?(client_id1_0), 'check if session is removed' )
assert( !Sessions.session_exists?(client_id1_1), 'check if session is removed' )
assert( !Sessions.session_exists?(client_id2), 'check if session is removed' )
end

View file

@ -59,7 +59,7 @@ class StoreTest < ActiveSupport::TestCase
}
success = Store::File.verify
assert success, "verify ok"
assert success, 'verify ok'
Store::File.move( 'DB', 'File' )
@ -85,7 +85,7 @@ class StoreTest < ActiveSupport::TestCase
}
success = Store::File.verify
assert success, "verify ok"
assert success, 'verify ok'
Store::File.move( 'File', 'DB' )

View file

@ -97,11 +97,11 @@ class TagTest < ActiveSupport::TestCase
if test[:tag_add]
tags = test[:tag_add]
success = Tag.tag_add( tags )
assert( success, "Tag.tag_add successful")
assert( success, 'Tag.tag_add successful')
else
tags = test[:tag_remove]
success = Tag.tag_remove( tags )
assert( success, "Tag.tag_remove successful")
assert( success, 'Tag.tag_remove successful')
end
list = Tag.tag_list( tags )
test[:verify][:items].each {|key, value|
@ -122,9 +122,9 @@ class TagTest < ActiveSupport::TestCase
tags = test[:tag_remove]
end
success = Tag.tag_remove( tags )
assert( success, "Tag.tag_remove successful")
assert( success, 'Tag.tag_remove successful')
list = Tag.tag_list( tags )
assert( !list.include?( tags[:item] ), "Tag entry destroyed")
assert( !list.include?( tags[:item] ), 'Tag entry destroyed')
}
end
end

View file

@ -52,7 +52,7 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( customer1.id, ticket.customer.id )
assert_equal( organization1.id, ticket.organization.id )

View file

@ -83,7 +83,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
:updated_by_id => customer.id,
:created_by_id => customer.id,
)
assert( ticket1, "ticket created - ticket notification simple" )
assert( ticket1, 'ticket created - ticket notification simple' )
# execute ticket events
Observer::Ticket::Notification.transaction
@ -184,7 +184,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
Observer::Ticket::Notification.transaction
#puts Delayed::Job.all.inspect
Delayed::Worker.new.work_off
assert( ticket2, "ticket created" )
assert( ticket2, 'ticket created' )
# verify notifications to no one
assert_equal( 0, notification_check(ticket2, agent1), ticket2.id )
@ -251,7 +251,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
Observer::Ticket::Notification.transaction
#puts Delayed::Job.all.inspect
Delayed::Worker.new.work_off
assert( ticket3, "ticket created" )
assert( ticket3, 'ticket created' )
# verify notifications to agent1 and not to agent2
assert_equal( 1, notification_check(ticket3, agent1), ticket3.id )
@ -303,13 +303,13 @@ class TicketNotificationTest < ActiveSupport::TestCase
delete = ticket1.destroy
assert( delete, "ticket1 destroy" )
assert( delete, 'ticket1 destroy' )
delete = ticket2.destroy
assert( delete, "ticket2 destroy" )
assert( delete, 'ticket2 destroy' )
delete = ticket3.destroy
assert( delete, "ticket3 destroy" )
assert( delete, 'ticket3 destroy' )
end
@ -338,7 +338,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
:updated_by_id => customer.id,
:created_by_id => customer.id,
)
assert( ticket1, "ticket created" )
assert( ticket1, 'ticket created' )
# execute ticket events
Observer::Ticket::Notification.transaction
@ -399,7 +399,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
:updated_by_id => customer.id,
:created_by_id => customer.id,
)
assert( ticket1, "ticket created - ticket notification template" )
assert( ticket1, 'ticket created - ticket notification template' )
bg = Observer::Ticket::Notification::BackgroundJob.new(
:ticket_id => ticket1.id,
@ -407,7 +407,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
:type => 'update',
:changes => {
'priority_id' => [1, 2],
'pending_time' => [nil, Time.parse("2015-01-11 23:33:47 UTC")],
'pending_time' => [nil, Time.parse('2015-01-11 23:33:47 UTC')],
},
)

View file

@ -65,43 +65,43 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.customer.id, customer1.id )
assert_equal( ticket.organization.id, organization1.id )
# check if customer and organization has been touched
customer1 = User.find(customer1.id)
if customer1.updated_at > 2.second.ago
assert( true, "customer1.updated_at has been updated" )
assert( true, 'customer1.updated_at has been updated' )
else
assert( false, "customer1.updated_at has not been updated" )
assert( false, 'customer1.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( true, "organization1.updated_at has been updated" )
assert( true, 'organization1.updated_at has been updated' )
else
assert( false, "organization1.updated_at has not been updated" )
assert( false, 'organization1.updated_at has not been updated' )
end
sleep 4
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
# check if customer and organization has been touched
customer1 = User.find(customer1.id)
if customer1.updated_at > 2.second.ago
assert( true, "customer1.updated_at has been updated" )
assert( true, 'customer1.updated_at has been updated' )
else
assert( false, "customer1.updated_at has not been updated" )
assert( false, 'customer1.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( true, "organization1.updated_at has been updated" )
assert( true, 'organization1.updated_at has been updated' )
else
assert( false, "organization1.updated_at has not been updated" )
assert( false, 'organization1.updated_at has not been updated' )
end
end
@ -118,43 +118,43 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.customer.id, customer2.id )
assert_equal( ticket.organization, nil )
# check if customer and organization has been touched
customer2 = User.find(customer2.id)
if customer2.updated_at > 2.second.ago
assert( true, "customer2.updated_at has been updated" )
assert( true, 'customer2.updated_at has been updated' )
else
assert( false, "customer2.updated_at has not been updated" )
assert( false, 'customer2.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( false, "organization1.updated_at has been updated" )
assert( false, 'organization1.updated_at has been updated' )
else
assert( true, "organization1.updated_at has not been updated" )
assert( true, 'organization1.updated_at has not been updated' )
end
sleep 3
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
# check if customer and organization has been touched
customer2 = User.find(customer2.id)
if customer2.updated_at > 2.second.ago
assert( true, "customer2.updated_at has been updated" )
assert( true, 'customer2.updated_at has been updated' )
else
assert( false, "customer2.updated_at has not been updated" )
assert( false, 'customer2.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( false, "organization1.updated_at has been updated" )
assert( false, 'organization1.updated_at has been updated' )
else
assert( true, "organization1.updated_at has not been updated" )
assert( true, 'organization1.updated_at has not been updated' )
end
end

View file

@ -6,9 +6,9 @@ class TicketSlaTest < ActiveSupport::TestCase
# cleanup
delete = Sla.destroy_all
assert( delete, "sla destroy_all" )
assert( delete, 'sla destroy_all' )
delete = Ticket.destroy_all
assert( delete, "ticket destroy_all" )
assert( delete, 'ticket destroy_all' )
ticket = Ticket.create(
:title => 'some title äöüß',
@ -21,16 +21,16 @@ class TicketSlaTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
sla = Sla.create(
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "8:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '8:00',
'end_of_workday' => '18:00',
},
:first_response_time => 120,
:update_time => 180,
@ -45,15 +45,15 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
delete = sla.destroy
assert( delete, "sla destroy 1" )
assert( delete, 'sla destroy 1' )
sla = Sla.create(
:name => 'test sla 2',
:condition => { "tickets.priority_id" =>["1", "2", "3"] },
:condition => { 'tickets.priority_id' =>['1', '2', '3'] },
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "8:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '8:00',
'end_of_workday' => '18:00',
},
:first_response_time => 60,
:update_time => 120,
@ -213,7 +213,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_diff_in_min, -30, 'ticket.close_time_diff_in_min verify 9' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
ticket = Ticket.create(
:title => 'some title äöüß',
@ -226,7 +226,7 @@ class TicketSlaTest < ActiveSupport::TestCase
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
@ -284,7 +284,7 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time, nil, 'ticket.close_time verify - outbound' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
ticket = Ticket.create(
@ -298,7 +298,7 @@ class TicketSlaTest < ActiveSupport::TestCase
:created_at => '2013-03-28 23:49:00 UTC',
:updated_at => '2013-03-28 23:49:00 UTC',
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
@ -328,19 +328,19 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time, nil, 'ticket.close_time verify - inbound' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
end
test 'ticket sla + timezone' do
# cleanup
delete = Sla.destroy_all
assert( delete, "sla destroy_all" )
assert( delete, 'sla destroy_all' )
delete = Ticket.destroy_all
assert( delete, "ticket destroy_all" )
assert( delete, 'ticket destroy_all' )
ticket = Ticket.create(
:title => 'some title äöüß',
@ -353,7 +353,7 @@ class TicketSlaTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 8:00-17:00
@ -361,9 +361,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:timezone => 'Europe/Berlin',
:first_response_time => 120,
@ -380,10 +380,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
ticket = Ticket.create(
:title => 'some title äöüß',
:group => Group.lookup( :name => 'Users'),
@ -395,7 +395,7 @@ class TicketSlaTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
@ -403,9 +403,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:timezone => 'Europe/Berlin',
:first_response_time => 120,
@ -422,10 +422,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
ticket = Ticket.create(
:title => 'some title äöüß',
@ -438,7 +438,7 @@ class TicketSlaTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.escalation_time, nil, 'ticket.escalation_time verify' )
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
@ -446,9 +446,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:timezone => 'Europe/Berlin',
:first_response_time => 120,
@ -465,10 +465,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 11:00:00 UTC', 'ticket.close_time_escal_date verify 1' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
end
@ -550,9 +550,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:timezone => 'Europe/Berlin',
:first_response_time => 120,
@ -572,10 +572,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_in_min, 150, 'ticket.close_time_in_min verify 3' )
assert_equal( ticket.close_time_diff_in_min, 100, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
# test Ticket created in state pending and closed without reopen or state change
ticket = Ticket.create(
@ -614,9 +614,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:first_response_time => 120,
:update_time => 180,
@ -637,10 +637,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_diff_in_min, 240, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
# test Ticket created in state pending, changed state to openen, back to pending and closed
@ -709,9 +709,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:first_response_time => 120,
:update_time => 180,
@ -732,10 +732,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_diff_in_min, 210, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
### Test Ticket created in state pending, changed state to openen, back to pending and back to open then
### close ticket
@ -819,9 +819,9 @@ class TicketSlaTest < ActiveSupport::TestCase
:name => 'test sla 1',
:condition => {},
:data => {
"Mon"=>"Mon", "Tue"=>"Tue", "Wed"=>"Wed", "Thu"=>"Thu", "Fri"=>"Fri", "Sat"=>"Sat", "Sun"=>"Sun",
"beginning_of_workday" => "9:00",
"end_of_workday" => "18:00",
'Mon'=>'Mon', 'Tue'=>'Tue', 'Wed'=>'Wed', 'Thu'=>'Thu', 'Fri'=>'Fri', 'Sat'=>'Sat', 'Sun'=>'Sun',
'beginning_of_workday' => '9:00',
'end_of_workday' => '18:00',
},
:first_response_time => 120,
:update_time => 180,
@ -842,10 +842,10 @@ class TicketSlaTest < ActiveSupport::TestCase
assert_equal( ticket.close_time_diff_in_min, 180, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy
assert( delete, "sla destroy" )
assert( delete, 'sla destroy' )
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
end
end

View file

@ -12,7 +12,7 @@ class TicketTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.title, 'some title äöüß', 'ticket.title verify' )
assert_equal( ticket.group.name, 'Users', 'ticket.group verify' )
@ -54,7 +54,7 @@ class TicketTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert_equal( article_note.subject, "some note", 'article_note.subject verify - inbound' )
assert_equal( article_note.subject, 'some note', 'article_note.subject verify - inbound' )
assert_equal( article_note.body, "some\n message", 'article_note.body verify - inbound' )
ticket = Ticket.find(ticket.id)
@ -103,12 +103,12 @@ class TicketTest < ActiveSupport::TestCase
# set pending time
ticket.state_id = Ticket::State.where(:name => 'pending reminder').first.id
ticket.pending_time = Time.parse("1977-10-27 22:00:00 +0000")
ticket.pending_time = Time.parse('1977-10-27 22:00:00 +0000')
ticket.save
ticket = Ticket.find(ticket.id)
assert_equal( ticket.state.name, 'pending reminder', 'state verify' )
assert_equal( ticket.pending_time, Time.parse("1977-10-27 22:00:00 +0000"), 'pending_time verify' )
assert_equal( ticket.pending_time, Time.parse('1977-10-27 22:00:00 +0000'), 'pending_time verify' )
# reset pending state, should also reset pending time
@ -121,7 +121,7 @@ class TicketTest < ActiveSupport::TestCase
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
end

View file

@ -28,7 +28,7 @@ class TranslationTest < ActiveSupport::TestCase
]
tests.each { |test|
result = Translation.translate( test[:locale], test[:string] )
assert_equal( result, test[:result], "verify result" )
assert_equal( result, test[:result], 'verify result' )
}
end
end

View file

@ -65,7 +65,7 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
:updated_by_id => 1,
:created_by_id => 1,
)
assert( ticket, "ticket created" )
assert( ticket, 'ticket created' )
assert_equal( ticket.customer.id, customer1.id )
assert_equal( ticket.organization.id, organization1.id )
@ -77,9 +77,9 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
# check if organization has been touched
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( true, "organization1.updated_at has been updated" )
assert( true, 'organization1.updated_at has been updated' )
else
assert( false, "organization1.updated_at has not been updated" )
assert( false, 'organization1.updated_at has not been updated' )
end
sleep 4
@ -90,27 +90,27 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
# check if customer1, customer2 and organization has been touched
customer1 = User.find(customer1.id)
if customer1.updated_at > 2.second.ago
assert( true, "customer1.updated_at has been updated" )
assert( true, 'customer1.updated_at has been updated' )
else
assert( false, "customer1.updated_at has not been updated" )
assert( false, 'customer1.updated_at has not been updated' )
end
customer2 = User.find(customer2.id)
if customer2.updated_at > 2.second.ago
assert( true, "customer2.updated_at has been updated" )
assert( true, 'customer2.updated_at has been updated' )
else
assert( false, "customer2.updated_at has not been updated" )
assert( false, 'customer2.updated_at has not been updated' )
end
organization1 = Organization.find(organization1.id)
if organization1.updated_at > 2.second.ago
assert( true, "organization1.updated_at has been updated" )
assert( true, 'organization1.updated_at has been updated' )
else
assert( false, "organization1.updated_at has not been updated" )
assert( false, 'organization1.updated_at has not been updated' )
end
delete = ticket.destroy
assert( delete, "ticket destroy" )
assert( delete, 'ticket destroy' )
end
end