Maintenance: Activated rubocop Layout/SpaceInsideParens.
This commit is contained in:
parent
5243efbc25
commit
916bb77066
96 changed files with 305 additions and 310 deletions
|
@ -81,11 +81,6 @@ Style/RescueStandardError:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
EnforcedStyle: implicit
|
EnforcedStyle: implicit
|
||||||
|
|
||||||
Layout/SpaceInsideParens:
|
|
||||||
Description: 'No spaces after ( or before ).'
|
|
||||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Layout/LeadingCommentSpace:
|
Layout/LeadingCommentSpace:
|
||||||
Description: 'Comments should start with a space.'
|
Description: 'Comments should start with a space.'
|
||||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ChannelsGoogleController < ApplicationController
|
||||||
channel.refresh_xoauth2!(force: true)
|
channel.refresh_xoauth2!(force: true)
|
||||||
|
|
||||||
result = EmailHelper::Probe.inbound(channel.options[:inbound])
|
result = EmailHelper::Probe.inbound(channel.options[:inbound])
|
||||||
raise Exceptions::UnprocessableEntity, ( result[:message_human] || result[:message] ) if result[:result] == 'invalid'
|
raise Exceptions::UnprocessableEntity, (result[:message_human] || result[:message]) if result[:result] == 'invalid'
|
||||||
|
|
||||||
channel.status_in = 'ok'
|
channel.status_in = 'ok'
|
||||||
channel.status_out = 'ok'
|
channel.status_out = 'ok'
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ChannelsMicrosoft365Controller < ApplicationController
|
||||||
channel.refresh_xoauth2!(force: true)
|
channel.refresh_xoauth2!(force: true)
|
||||||
|
|
||||||
result = EmailHelper::Probe.inbound(channel.options[:inbound])
|
result = EmailHelper::Probe.inbound(channel.options[:inbound])
|
||||||
raise Exceptions::UnprocessableEntity, ( result[:message_human] || result[:message] ) if result[:result] == 'invalid'
|
raise Exceptions::UnprocessableEntity, (result[:message_human] || result[:message]) if result[:result] == 'invalid'
|
||||||
|
|
||||||
channel.status_in = 'ok'
|
channel.status_in = 'ok'
|
||||||
channel.status_out = 'ok'
|
channel.status_out = 'ok'
|
||||||
|
|
|
@ -37,7 +37,7 @@ class UserDevicesController < ApplicationController
|
||||||
next if !session.data['user_device_id']
|
next if !session.data['user_device_id']
|
||||||
next if session.data['user_device_id'] != user_device.id
|
next if session.data['user_device_id'] != user_device.id
|
||||||
|
|
||||||
SessionHelper.destroy( session.id )
|
SessionHelper.destroy(session.id)
|
||||||
end
|
end
|
||||||
user_device.destroy
|
user_device.destroy
|
||||||
end
|
end
|
||||||
|
|
|
@ -65,7 +65,7 @@ add a new activity entry for an object
|
||||||
# return if old entry is really fresh
|
# return if old entry is really fresh
|
||||||
if result
|
if result
|
||||||
activity_record_delay = 90.seconds
|
activity_record_delay = 90.seconds
|
||||||
return result if result.created_at.to_i >= ( data[:created_at].to_i - activity_record_delay )
|
return result if result.created_at.to_i >= (data[:created_at].to_i - activity_record_delay)
|
||||||
end
|
end
|
||||||
|
|
||||||
# create history
|
# create history
|
||||||
|
|
|
@ -146,7 +146,7 @@ returns
|
||||||
|
|
||||||
if keys.size > 1
|
if keys.size > 1
|
||||||
values = ids.transpose.map(&:compact).map(&:uniq)
|
values = ids.transpose.map(&:compact).map(&:uniq)
|
||||||
attributes.merge!( keys.zip( values ).to_h )
|
attributes.merge!(keys.zip(values).to_h)
|
||||||
else
|
else
|
||||||
attributes[ keys.first ] = ids.compact
|
attributes[ keys.first ] = ids.compact
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ module Channel::Filter::FollowUpCheck
|
||||||
end
|
end
|
||||||
|
|
||||||
# get ticket# from references
|
# get ticket# from references
|
||||||
return true if ( setting.include?('references') || (mail[:'x-zammad-is-auto-response'] == true || Setting.get('ticket_hook_position') == 'none') ) && follow_up_by_md5(mail)
|
return true if (setting.include?('references') || (mail[:'x-zammad-is-auto-response'] == true || Setting.get('ticket_hook_position') == 'none')) && follow_up_by_md5(mail)
|
||||||
|
|
||||||
# get ticket# from references current email has same subject as initial article
|
# get ticket# from references current email has same subject as initial article
|
||||||
if mail[:subject].present?
|
if mail[:subject].present?
|
||||||
|
|
|
@ -320,7 +320,7 @@ module HasGroups
|
||||||
|
|
||||||
# check direct access
|
# check direct access
|
||||||
instances = joins(group_through.name)
|
instances = joins(group_through.name)
|
||||||
.where( group_through.table_name => { group_id: group_id, access: access }, active: true )
|
.where(group_through.table_name => { group_id: group_id, access: access }, active: true)
|
||||||
|
|
||||||
if method_defined?(:permissions?)
|
if method_defined?(:permissions?)
|
||||||
permissions = Permission.with_parents('ticket.agent')
|
permissions = Permission.with_parents('ticket.agent')
|
||||||
|
|
|
@ -10,7 +10,7 @@ class KnowledgeBase::MenuItem < ApplicationModel
|
||||||
acts_as_list scope: %i[kb_locale_id location], top_of_list: 0
|
acts_as_list scope: %i[kb_locale_id location], top_of_list: 0
|
||||||
|
|
||||||
scope :sorted, -> { order(position: :asc) }
|
scope :sorted, -> { order(position: :asc) }
|
||||||
scope :using_locale, ->(locale) { locale.present? ? joins(:kb_locale).where(knowledge_base_locales: { system_locale_id: locale.id } ) : none }
|
scope :using_locale, ->(locale) { locale.present? ? joins(:kb_locale).where(knowledge_base_locales: { system_locale_id: locale.id }) : none }
|
||||||
scope :location, ->(location) { sorted.where(location: location) }
|
scope :location, ->(location) { sorted.where(location: location) }
|
||||||
|
|
||||||
scope :location_header, -> { location(:header) }
|
scope :location_header, -> { location(:header) }
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Link < ApplicationModel
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.list(data)
|
def self.list(data)
|
||||||
linkobject = link_object_get( name: data[:link_object] )
|
linkobject = link_object_get(name: data[:link_object])
|
||||||
return if !linkobject
|
return if !linkobject
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
|
@ -35,8 +35,8 @@ class Link < ApplicationModel
|
||||||
|
|
||||||
list.each do |item|
|
list.each do |item|
|
||||||
link = {}
|
link = {}
|
||||||
link['link_type'] = @map[ Link::Type.find( item.link_type_id ).name ]
|
link['link_type'] = @map[ Link::Type.find(item.link_type_id).name ]
|
||||||
link['link_object'] = Link::Object.find( item.link_object_target_id ).name
|
link['link_object'] = Link::Object.find(item.link_object_target_id).name
|
||||||
link['link_object_value'] = item.link_object_target_value
|
link['link_object_value'] = item.link_object_target_value
|
||||||
items.push link
|
items.push link
|
||||||
end
|
end
|
||||||
|
@ -47,8 +47,8 @@ class Link < ApplicationModel
|
||||||
)
|
)
|
||||||
list.each do |item|
|
list.each do |item|
|
||||||
link = {}
|
link = {}
|
||||||
link['link_type'] = Link::Type.find( item.link_type_id ).name
|
link['link_type'] = Link::Type.find(item.link_type_id).name
|
||||||
link['link_object'] = Link::Object.find( item.link_object_source_id ).name
|
link['link_object'] = Link::Object.find(item.link_object_source_id).name
|
||||||
link['link_object_value'] = item.link_object_source_value
|
link['link_object_value'] = item.link_object_source_value
|
||||||
items.push link
|
items.push link
|
||||||
end
|
end
|
||||||
|
|
|
@ -440,7 +440,7 @@ execute all pending package migrations at once
|
||||||
|
|
||||||
# check if directories need to be created
|
# check if directories need to be created
|
||||||
directories = location.split '/'
|
directories = location.split '/'
|
||||||
(0..(directories.length - 2) ).each do |position|
|
(0..(directories.length - 2)).each do |position|
|
||||||
tmp_path = ''
|
tmp_path = ''
|
||||||
(1..position).each do |count|
|
(1..position).each do |count|
|
||||||
tmp_path = "#{tmp_path}/#{directories[count]}"
|
tmp_path = "#{tmp_path}/#{directories[count]}"
|
||||||
|
|
|
@ -113,7 +113,7 @@ returns
|
||||||
end
|
end
|
||||||
|
|
||||||
if user.permissions?('ticket.customer')
|
if user.permissions?('ticket.customer')
|
||||||
if !user.organization || ( !user.organization.shared || user.organization.shared == false )
|
if !user.organization || (!user.organization.shared || user.organization.shared == false)
|
||||||
sql.push('tickets.customer_id = ?')
|
sql.push('tickets.customer_id = ?')
|
||||||
bind.push(user.id)
|
bind.push(user.id)
|
||||||
else
|
else
|
||||||
|
@ -661,7 +661,7 @@ condition example
|
||||||
biz = Calendar.lookup(id: selector['value'])&.biz
|
biz = Calendar.lookup(id: selector['value'])&.biz
|
||||||
next if biz.blank?
|
next if biz.blank?
|
||||||
|
|
||||||
if ( selector['operator'] == 'is in working time' && !biz.in_hours?(Time.zone.now) ) || ( selector['operator'] == 'is not in working time' && biz.in_hours?(Time.zone.now) )
|
if (selector['operator'] == 'is in working time' && !biz.in_hours?(Time.zone.now)) || (selector['operator'] == 'is not in working time' && biz.in_hours?(Time.zone.now))
|
||||||
no_result = true
|
no_result = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
|
@ -91,7 +91,7 @@ returns
|
||||||
return article if article['body'] !~ %r{<img}i
|
return article if article['body'] !~ %r{<img}i
|
||||||
|
|
||||||
inline_attachments = {}
|
inline_attachments = {}
|
||||||
article['body'].gsub!( %r{(<img[[:space:]](|.+?)src=")cid:(.+?)"(|.+?)>}im ) do |item|
|
article['body'].gsub!(%r{(<img[[:space:]](|.+?)src=")cid:(.+?)"(|.+?)>}im) do |item|
|
||||||
tag_start = $1
|
tag_start = $1
|
||||||
cid = $3
|
cid = $3
|
||||||
tag_end = $4
|
tag_end = $4
|
||||||
|
@ -99,7 +99,7 @@ returns
|
||||||
|
|
||||||
# look for attachment
|
# look for attachment
|
||||||
article['attachments'].each do |file|
|
article['attachments'].each do |file|
|
||||||
next if !file[:preferences] || !file[:preferences]['Content-ID'] || (file[:preferences]['Content-ID'] != cid && file[:preferences]['Content-ID'] != "<#{cid}>" )
|
next if !file[:preferences] || !file[:preferences]['Content-ID'] || (file[:preferences]['Content-ID'] != cid && file[:preferences]['Content-ID'] != "<#{cid}>")
|
||||||
|
|
||||||
replace = "#{tag_start}/api/v1/ticket_attachment/#{article['ticket_id']}/#{article['id']}/#{file[:id]}?view=inline\"#{tag_end}>"
|
replace = "#{tag_start}/api/v1/ticket_attachment/#{article['ticket_id']}/#{article['id']}/#{file[:id]}?view=inline\"#{tag_end}>"
|
||||||
inline_attachments[file[:id]] = true
|
inline_attachments[file[:id]] = true
|
||||||
|
@ -132,13 +132,13 @@ returns
|
||||||
|
|
||||||
def attachments_inline
|
def attachments_inline
|
||||||
inline_attachments = {}
|
inline_attachments = {}
|
||||||
body.gsub( %r{<img[[:space:]](|.+?)src="cid:(.+?)"(|.+?)>}im ) do |_item|
|
body.gsub(%r{<img[[:space:]](|.+?)src="cid:(.+?)"(|.+?)>}im) do |_item|
|
||||||
cid = $2
|
cid = $2
|
||||||
|
|
||||||
# look for attachment
|
# look for attachment
|
||||||
attachments.each do |file|
|
attachments.each do |file|
|
||||||
content_id = file.preferences['Content-ID'] || file.preferences['content_id']
|
content_id = file.preferences['Content-ID'] || file.preferences['content_id']
|
||||||
next if content_id.blank? || (content_id != cid && content_id != "<#{cid}>" )
|
next if content_id.blank? || (content_id != cid && content_id != "<#{cid}>")
|
||||||
|
|
||||||
inline_attachments[file.id] = true
|
inline_attachments[file.id] = true
|
||||||
break
|
break
|
||||||
|
|
|
@ -138,7 +138,7 @@ returns
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if current_user.permissions?('ticket.customer')
|
if current_user.permissions?('ticket.customer')
|
||||||
access_condition = if !current_user.organization || ( !current_user.organization.shared || current_user.organization.shared == false )
|
access_condition = if !current_user.organization || (!current_user.organization.shared || current_user.organization.shared == false)
|
||||||
{
|
{
|
||||||
'query_string' => { 'default_field' => 'customer_id', 'query' => current_user.id }
|
'query_string' => { 'default_field' => 'customer_id', 'query' => current_user.id }
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ returns
|
||||||
query.delete! '*'
|
query.delete! '*'
|
||||||
tickets_all = Ticket.select("DISTINCT(tickets.id), #{order_select_sql}")
|
tickets_all = Ticket.select("DISTINCT(tickets.id), #{order_select_sql}")
|
||||||
.where(access_condition)
|
.where(access_condition)
|
||||||
.where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" )
|
.where('(tickets.title LIKE ? OR tickets.number LIKE ? OR ticket_articles.body LIKE ? OR ticket_articles.from LIKE ? OR ticket_articles.to LIKE ? OR ticket_articles.subject LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%")
|
||||||
.joins(:articles)
|
.joins(:articles)
|
||||||
.order(Arel.sql(order_sql))
|
.order(Arel.sql(order_sql))
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
class TypeLookup < ApplicationModel
|
class TypeLookup < ApplicationModel
|
||||||
|
|
||||||
def self.by_id( id )
|
def self.by_id(id)
|
||||||
lookup = self.lookup( id: id )
|
lookup = self.lookup(id: id)
|
||||||
return if !lookup
|
return if !lookup
|
||||||
|
|
||||||
lookup.name
|
lookup.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.by_name( name )
|
def self.by_name(name)
|
||||||
# lookup
|
# lookup
|
||||||
lookup = self.lookup( name: name )
|
lookup = self.lookup(name: name)
|
||||||
if lookup
|
if lookup
|
||||||
return lookup.id
|
return lookup.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
# load all core_ext extensions
|
# load all core_ext extensions
|
||||||
Dir.glob( Rails.root.join('lib/core_ext/**/*') ).sort.each do |file|
|
Dir.glob(Rails.root.join('lib/core_ext/**/*')).sort.each do |file|
|
||||||
if File.file?(file)
|
if File.file?(file)
|
||||||
require file
|
require file
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
# load routes from external files
|
# load routes from external files
|
||||||
dir = File.expand_path(__dir__)
|
dir = File.expand_path(__dir__)
|
||||||
files = Dir.glob( "#{dir}/routes/*.rb" )
|
files = Dir.glob("#{dir}/routes/*.rb")
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
if Rails.configuration.cache_classes
|
if Rails.configuration.cache_classes
|
||||||
require_dependency file
|
require_dependency file
|
||||||
|
|
|
@ -403,7 +403,7 @@ class FixedTranslation < ActiveRecord::Migration[4.2]
|
||||||
]
|
]
|
||||||
|
|
||||||
settings_update.each do |setting|
|
settings_update.each do |setting|
|
||||||
fetched_setting = Setting.find_by(name: setting['name'] )
|
fetched_setting = Setting.find_by(name: setting['name'])
|
||||||
next if !fetched_setting
|
next if !fetched_setting
|
||||||
|
|
||||||
if setting['title']
|
if setting['title']
|
||||||
|
|
|
@ -44,7 +44,7 @@ class CalendarSubscriptions::Tickets
|
||||||
owner_ids = [ @user.id ]
|
owner_ids = [ @user.id ]
|
||||||
end
|
end
|
||||||
if preferences[:not_assigned]
|
if preferences[:not_assigned]
|
||||||
owner_ids.push( 1 )
|
owner_ids.push(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
owner_ids
|
owner_ids
|
||||||
|
|
|
@ -55,9 +55,9 @@ module Import
|
||||||
def sub_elems(elems)
|
def sub_elems(elems)
|
||||||
elems.each_with_object({}) do |elem, result|
|
elems.each_with_object({}) do |elem, result|
|
||||||
if elem[:entry]
|
if elem[:entry]
|
||||||
result.merge!( sub_elem_entry( elem[:entry] ) )
|
result.merge!(sub_elem_entry(elem[:entry]))
|
||||||
else
|
else
|
||||||
result.merge!( normalize(elem) )
|
result.merge!(normalize(elem))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -88,7 +88,7 @@ module Import
|
||||||
|
|
||||||
result_key = key
|
result_key = key
|
||||||
if prefix
|
if prefix
|
||||||
result_key = if keys.include?(key) && ( !result[result_key] || result[result_key] == value )
|
result_key = if keys.include?(key) && (!result[result_key] || result[result_key] == value)
|
||||||
prefix
|
prefix
|
||||||
else
|
else
|
||||||
:"#{prefix}.#{key}"
|
:"#{prefix}.#{key}"
|
||||||
|
|
|
@ -98,7 +98,7 @@ module Import
|
||||||
|
|
||||||
dynamic_field_name = key_string[13, key_string.length]
|
dynamic_field_name = key_string[13, key_string.length]
|
||||||
|
|
||||||
next if Import::OTRS::DynamicFieldFactory.skip_field?( dynamic_field_name )
|
next if Import::OTRS::DynamicFieldFactory.skip_field?(dynamic_field_name)
|
||||||
|
|
||||||
dynamic_field_name = Import::OTRS::DynamicField.convert_name(dynamic_field_name)
|
dynamic_field_name = Import::OTRS::DynamicField.convert_name(dynamic_field_name)
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ module Import
|
||||||
end
|
end
|
||||||
|
|
||||||
return result if !group['Name'].match?(%r{^(stats|report)})
|
return result if !group['Name'].match?(%r{^(stats|report)})
|
||||||
return result if !( permissions.include?('ro') || permissions.include?('rw') )
|
return result if !(permissions.include?('ro') || permissions.include?('rw'))
|
||||||
|
|
||||||
result.push 'Report'
|
result.push 'Report'
|
||||||
result
|
result
|
||||||
|
|
|
@ -18,7 +18,7 @@ module Import
|
||||||
def init_callback(_attribute); end
|
def init_callback(_attribute); end
|
||||||
|
|
||||||
def add(object, name, attribute)
|
def add(object, name, attribute)
|
||||||
ObjectManager::Attribute.add( attribute_config(object, name, attribute) )
|
ObjectManager::Attribute.add(attribute_config(object, name, attribute))
|
||||||
ObjectManager::Attribute.migration_execute(false)
|
ObjectManager::Attribute.migration_execute(false)
|
||||||
rescue
|
rescue
|
||||||
# rubocop:disable Style/SpecialGlobalVars
|
# rubocop:disable Style/SpecialGlobalVars
|
||||||
|
|
|
@ -333,7 +333,7 @@ class Report::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.ticket_condition(ticket_id, condition)
|
def self.ticket_condition(ticket_id, condition)
|
||||||
ticket = Ticket.lookup( id: ticket_id )
|
ticket = Ticket.lookup(id: ticket_id)
|
||||||
condition.each do |key, value|
|
condition.each do |key, value|
|
||||||
if ticket[key.to_sym] != value
|
if ticket[key.to_sym] != value
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -62,7 +62,7 @@ returns
|
||||||
ticket_list.each do |ticket|
|
ticket_list.each do |ticket|
|
||||||
closed_at = ticket.close_at
|
closed_at = ticket.close_at
|
||||||
created_at = ticket.created_at
|
created_at = ticket.created_at
|
||||||
if (closed_at - (60 * 15) ) < created_at
|
if (closed_at - (60 * 15)) < created_at
|
||||||
count += 1
|
count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -112,7 +112,7 @@ returns
|
||||||
ticket_list.each do |ticket|
|
ticket_list.each do |ticket|
|
||||||
closed_at = ticket.close_at
|
closed_at = ticket.close_at
|
||||||
created_at = ticket.created_at
|
created_at = ticket.created_at
|
||||||
if (closed_at - (60 * 15) ) < created_at
|
if (closed_at - (60 * 15)) < created_at
|
||||||
count += 1
|
count += 1
|
||||||
ticket_ids.push ticket.id
|
ticket_ids.push ticket.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Sequencer
|
||||||
result = {}
|
result = {}
|
||||||
client.group_memberships.all! do |group_membership|
|
client.group_memberships.all! do |group_membership|
|
||||||
result[ group_membership.user_id ] ||= []
|
result[ group_membership.user_id ] ||= []
|
||||||
result[ group_membership.user_id ].push( group_membership.group_id )
|
result[ group_membership.user_id ].push(group_membership.group_id)
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ module SessionHelper
|
||||||
|
|
||||||
# load collections to deliver from external files
|
# load collections to deliver from external files
|
||||||
dir = File.expand_path('..', __dir__)
|
dir = File.expand_path('..', __dir__)
|
||||||
files = Dir.glob( "#{dir}/lib/session_helper/collection_*.rb")
|
files = Dir.glob("#{dir}/lib/session_helper/collection_*.rb")
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
file =~ %r{/(session_helper/collection_.*)\.rb\z}
|
file =~ %r{/(session_helper/collection_.*)\.rb\z}
|
||||||
(default_collection, assets) = $1.camelize.constantize.session(default_collection, assets, user)
|
(default_collection, assets) = $1.camelize.constantize.session(default_collection, assets, user)
|
||||||
|
|
|
@ -4,7 +4,7 @@ module SessionHelper::CollectionBase
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def session( collections, assets, user )
|
def session(collections, assets, user)
|
||||||
|
|
||||||
# all base stuff
|
# all base stuff
|
||||||
collections[ Locale.to_app_model ] = Locale.where(active: true)
|
collections[ Locale.to_app_model ] = Locale.where(active: true)
|
||||||
|
|
|
@ -4,7 +4,7 @@ module SessionHelper::CollectionDashboard
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def session( collections, assets, user )
|
def session(collections, assets, user)
|
||||||
return [collections, assets] if !user
|
return [collections, assets] if !user
|
||||||
|
|
||||||
item = StatsStore.find_by(
|
item = StatsStore.find_by(
|
||||||
|
|
|
@ -4,7 +4,7 @@ module SessionHelper::CollectionTicket
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def session( collections, assets, user )
|
def session(collections, assets, user)
|
||||||
|
|
||||||
# all ticket stuff
|
# all ticket stuff
|
||||||
collections[ Ticket::StateType.to_app_model ] = []
|
collections[ Ticket::StateType.to_app_model ] = []
|
||||||
|
|
|
@ -152,7 +152,7 @@ returns
|
||||||
list_of_closed_sessions = []
|
list_of_closed_sessions = []
|
||||||
clients = Sessions.list
|
clients = Sessions.list
|
||||||
clients.each do |client_id, client|
|
clients.each do |client_id, client|
|
||||||
if !client[:meta] || !client[:meta][:last_ping] || ( client[:meta][:last_ping].to_i + idle_time_in_sec ) < Time.now.utc.to_i
|
if !client[:meta] || !client[:meta][:last_ping] || (client[:meta][:last_ping].to_i + idle_time_in_sec) < Time.now.utc.to_i
|
||||||
list_of_closed_sessions.push client_id
|
list_of_closed_sessions.push client_id
|
||||||
Sessions.destroy(client_id)
|
Sessions.destroy(client_id)
|
||||||
end
|
end
|
||||||
|
@ -579,7 +579,7 @@ returns
|
||||||
Sessions::Client.new(client_id, node_id)
|
Sessions::Client.new(client_id, node_id)
|
||||||
rescue => e
|
rescue => e
|
||||||
log('error', "thread_client #{client_id} exited with error #{e.inspect}")
|
log('error', "thread_client #{client_id} exited with error #{e.inspect}")
|
||||||
log('error', e.backtrace.join("\n ") )
|
log('error', e.backtrace.join("\n "))
|
||||||
sleep 10
|
sleep 10
|
||||||
begin
|
begin
|
||||||
ActiveRecord::Base.connection_pool.release_connection
|
ActiveRecord::Base.connection_pool.release_connection
|
||||||
|
@ -591,7 +591,7 @@ returns
|
||||||
try_count += 1
|
try_count += 1
|
||||||
|
|
||||||
# reset error counter if to old
|
# reset error counter if to old
|
||||||
if try_run_time + ( 60 * 5 ) < Time.now.utc
|
if try_run_time + (60 * 5) < Time.now.utc
|
||||||
try_count = 0
|
try_count = 0
|
||||||
end
|
end
|
||||||
try_run_time = Time.now.utc
|
try_run_time = Time.now.utc
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Sessions::Store::File
|
||||||
|
|
||||||
def set(client_id, data)
|
def set(client_id, data)
|
||||||
path = "#{@path}/#{client_id}"
|
path = "#{@path}/#{client_id}"
|
||||||
File.open("#{path}/session", 'wb' ) do |file|
|
File.open("#{path}/session", 'wb') do |file|
|
||||||
file.flock(File::LOCK_EX)
|
file.flock(File::LOCK_EX)
|
||||||
file.write data.to_json
|
file.write data.to_json
|
||||||
file.flock(File::LOCK_UN)
|
file.flock(File::LOCK_UN)
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Sessions::Store::Redis
|
||||||
# Only load redis if it is really used.
|
# Only load redis if it is really used.
|
||||||
require 'redis'
|
require 'redis'
|
||||||
require 'hiredis'
|
require 'hiredis'
|
||||||
@redis = Redis.new( driver: :hiredis )
|
@redis = Redis.new(driver: :hiredis)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(client_id, data)
|
def create(client_id, data)
|
||||||
|
|
|
@ -128,7 +128,7 @@ sql = 'tickets.created_at, tickets.updated_at'
|
||||||
next if value.blank?
|
next if value.blank?
|
||||||
next if order_by[index].blank?
|
next if order_by[index].blank?
|
||||||
|
|
||||||
sql.push( "#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}" )
|
sql.push("#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}")
|
||||||
end
|
end
|
||||||
|
|
||||||
sql = set_sql_order_default(sql, default)
|
sql = set_sql_order_default(sql, default)
|
||||||
|
@ -162,7 +162,7 @@ sql = 'tickets.created_at ASC, tickets.updated_at DESC'
|
||||||
next if value.blank?
|
next if value.blank?
|
||||||
next if order_by[index].blank?
|
next if order_by[index].blank?
|
||||||
|
|
||||||
sql.push( "#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}" )
|
sql.push("#{ActiveRecord::Base.connection.quote_table_name(@object.table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
sql = set_sql_order_default(sql, default)
|
sql = set_sql_order_default(sql, default)
|
||||||
|
|
|
@ -71,7 +71,7 @@ returns
|
||||||
def self.read_raw
|
def self.read_raw
|
||||||
list = Store.list(object: 'System::Logo', o_id: 1)
|
list = Store.list(object: 'System::Logo', o_id: 1)
|
||||||
if list && list[0]
|
if list && list[0]
|
||||||
return Store.find( list[0] )
|
return Store.find(list[0])
|
||||||
end
|
end
|
||||||
|
|
||||||
raise 'No such raw logo!'
|
raise 'No such raw logo!'
|
||||||
|
|
|
@ -63,7 +63,7 @@ returns
|
||||||
|
|
||||||
# generate average param and icon state
|
# generate average param and icon state
|
||||||
backend_average_sum.each do |backend_model_average, result|
|
backend_average_sum.each do |backend_model_average, result|
|
||||||
average = ( result.to_f / agent_count ).round(1)
|
average = (result.to_f / agent_count).round(1)
|
||||||
user_result.each do |user, data|
|
user_result.each do |user, data|
|
||||||
next if !data[backend_model_average]
|
next if !data[backend_model_average]
|
||||||
next if !data[backend_model_average].key?(:used_for_average)
|
next if !data[backend_model_average].key?(:used_for_average)
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Stats::TicketChannelDistribution
|
||||||
type_ids.push type.id
|
type_ids.push type.id
|
||||||
end
|
end
|
||||||
|
|
||||||
sender = Ticket::Article::Sender.lookup( name: 'Customer' )
|
sender = Ticket::Article::Sender.lookup(name: 'Customer')
|
||||||
count = Ticket.where(group_id: group_ids).joins(:articles).where(
|
count = Ticket.where(group_id: group_ids).joins(:articles).where(
|
||||||
ticket_articles: { sender_id: sender, type_id: type_ids }
|
ticket_articles: { sender_id: sender, type_id: type_ids }
|
||||||
).where(
|
).where(
|
||||||
|
@ -100,7 +100,7 @@ class Stats::TicketChannelDistribution
|
||||||
result[channel[:sender].to_sym][:inbound] = count
|
result[channel[:sender].to_sym][:inbound] = count
|
||||||
total_in += count
|
total_in += count
|
||||||
|
|
||||||
sender = Ticket::Article::Sender.lookup( name: 'Agent' )
|
sender = Ticket::Article::Sender.lookup(name: 'Agent')
|
||||||
count = Ticket.where(group_id: group_ids).joins(:articles).where(
|
count = Ticket.where(group_id: group_ids).joins(:articles).where(
|
||||||
ticket_articles: { sender_id: sender, type_id: type_ids }
|
ticket_articles: { sender_id: sender, type_id: type_ids }
|
||||||
).where(
|
).where(
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Stats::TicketInProcess
|
||||||
average_in_percent = '-'
|
average_in_percent = '-'
|
||||||
|
|
||||||
if total.nonzero?
|
if total.nonzero?
|
||||||
in_process_precent = ( count.to_f / (total.to_f / 100) ).round(1)
|
in_process_precent = (count.to_f / (total.to_f / 100)).round(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ class Stats::TicketInProcess
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1)
|
in_percent = (result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100)).round(1)
|
||||||
result[:state] = if in_percent >= 90
|
result[:state] = if in_percent >= 90
|
||||||
'supergood'
|
'supergood'
|
||||||
elsif in_percent >= 65
|
elsif in_percent >= 65
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Stats::TicketLoadMeasure
|
||||||
end
|
end
|
||||||
|
|
||||||
if total.nonzero?
|
if total.nonzero?
|
||||||
load_measure_precent = ( count.to_f / (total.to_f / 100) ).round(1)
|
load_measure_precent = (count.to_f / (total.to_f / 100)).round(1)
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
used_for_average: load_measure_precent,
|
used_for_average: load_measure_precent,
|
||||||
|
@ -42,7 +42,7 @@ class Stats::TicketLoadMeasure
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1)
|
in_percent = (result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100)).round(1)
|
||||||
result[:average_per_agent_in_percent] = in_percent
|
result[:average_per_agent_in_percent] = in_percent
|
||||||
result[:state] = if in_percent >= 90
|
result[:state] = if in_percent >= 90
|
||||||
'supergood'
|
'supergood'
|
||||||
|
@ -57,7 +57,7 @@ class Stats::TicketLoadMeasure
|
||||||
end
|
end
|
||||||
|
|
||||||
# convert result[:used_for_average] in percent to related total
|
# convert result[:used_for_average] in percent to related total
|
||||||
result[:average_per_agent] = ( (result[:total].to_f / 100) * result[:average_per_agent] ).round(1)
|
result[:average_per_agent] = ((result[:total].to_f / 100) * result[:average_per_agent]).round(1)
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Stats::TicketReopen
|
||||||
|
|
||||||
reopen_in_precent = 0
|
reopen_in_precent = 0
|
||||||
if total.nonzero?
|
if total.nonzero?
|
||||||
reopen_in_precent = ( count.to_f / (total.to_f / 100) ).round(1)
|
reopen_in_precent = (count.to_f / (total.to_f / 100)).round(1)
|
||||||
end
|
end
|
||||||
{
|
{
|
||||||
used_for_average: reopen_in_precent,
|
used_for_average: reopen_in_precent,
|
||||||
|
@ -45,7 +45,7 @@ class Stats::TicketReopen
|
||||||
|
|
||||||
#in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1)
|
#in_percent = ( result[:used_for_average].to_f / (result[:average_per_agent].to_f / 100) ).round(1)
|
||||||
#result[:average_per_agent_in_percent] = in_percent
|
#result[:average_per_agent_in_percent] = in_percent
|
||||||
in_percent = ( result[:count].to_f / (result[:total].to_f / 100) ).round(1)
|
in_percent = (result[:count].to_f / (result[:total].to_f / 100)).round(1)
|
||||||
result[:state] = if in_percent >= 90
|
result[:state] = if in_percent >= 90
|
||||||
'superbad'
|
'superbad'
|
||||||
elsif in_percent >= 65
|
elsif in_percent >= 65
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Stats::TicketResponseTime
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
in_percent = ( result[:used_for_average].to_f / (result[:total].to_f / 100) ).round(1)
|
in_percent = (result[:used_for_average].to_f / (result[:total].to_f / 100)).round(1)
|
||||||
result[:state] = if in_percent >= 90
|
result[:state] = if in_percent >= 90
|
||||||
'supergood'
|
'supergood'
|
||||||
elsif in_percent >= 65
|
elsif in_percent >= 65
|
||||||
|
|
|
@ -19,7 +19,7 @@ module Tasks
|
||||||
abort "Error: please provide a package name: #{ARGV[0]} MyPackage"
|
abort "Error: please provide a package name: #{ARGV[0]} MyPackage"
|
||||||
end
|
end
|
||||||
# Find the package so that we don't need to require the version from the command line.
|
# Find the package so that we don't need to require the version from the command line.
|
||||||
package = ::Package.find_by( name: name )
|
package = ::Package.find_by(name: name)
|
||||||
if package.blank?
|
if package.blank?
|
||||||
abort "Error: package #{name} was not found."
|
abort "Error: package #{name} was not found."
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ class WebsocketServer
|
||||||
|
|
||||||
Rails.configuration.interface = 'websocket'
|
Rails.configuration.interface = 'websocket'
|
||||||
EventMachine.run do
|
EventMachine.run do
|
||||||
EventMachine::WebSocket.start( host: @options[:b], port: @options[:p], secure: @options[:s], tls_options: @options[:tls_options] ) do |ws|
|
EventMachine::WebSocket.start(host: @options[:b], port: @options[:p], secure: @options[:s], tls_options: @options[:tls_options]) do |ws|
|
||||||
|
|
||||||
# register client connection
|
# register client connection
|
||||||
ws.onopen do |handshake|
|
ws.onopen do |handshake|
|
||||||
|
@ -52,7 +52,7 @@ class WebsocketServer
|
||||||
headers = handshake.headers
|
headers = handshake.headers
|
||||||
client_id = websocket.object_id.to_s
|
client_id = websocket.object_id.to_s
|
||||||
log 'info', 'Client connected.', client_id
|
log 'info', 'Client connected.', client_id
|
||||||
Sessions.create( client_id, {}, { type: 'websocket' } )
|
Sessions.create(client_id, {}, { type: 'websocket' })
|
||||||
|
|
||||||
return if @clients.include? client_id
|
return if @clients.include? client_id
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class WebsocketServer
|
||||||
# close unused web socket sessions
|
# close unused web socket sessions
|
||||||
@clients.each do |client_id, client|
|
@clients.each do |client_id, client|
|
||||||
|
|
||||||
next if ( client[:last_ping].to_i + idle_time_in_sec ) >= Time.now.utc.to_i
|
next if (client[:last_ping].to_i + idle_time_in_sec) >= Time.now.utc.to_i
|
||||||
|
|
||||||
log 'info', 'closing idle websocket connection', client_id
|
log 'info', 'closing idle websocket connection', client_id
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ RSpec.describe Issue2541FixNotificationEmailWithoutBody, type: :db_migration do
|
||||||
subject(:job) do
|
subject(:job) do
|
||||||
UserInfo.ensure_current_user_id do
|
UserInfo.ensure_current_user_id do
|
||||||
|
|
||||||
create(:job, condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } } )
|
create(:job, condition: { 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'current_user.id', 'value' => '', 'value_completion' => '' } })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ FactoryBot.define do
|
||||||
fixture { nil }
|
fixture { nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
public_key { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.crt") ) if fixture }
|
public_key { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.crt")) if fixture }
|
||||||
|
|
||||||
trait :with_private do
|
trait :with_private do
|
||||||
private_key { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.key") ) }
|
private_key { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.key")) }
|
||||||
private_key_secret { File.read( Rails.root.join("spec/fixtures/smime/#{fixture}.secret") ).strip! }
|
private_key_secret { File.read(Rails.root.join("spec/fixtures/smime/#{fixture}.secret")).strip! }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@ FactoryBot.define do
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :agent_and_customer do
|
factory :agent_and_customer do
|
||||||
role_ids { Role.signup_role_ids.push( Role.find_by(name: 'Agent').id ).sort }
|
role_ids { Role.signup_role_ids.push(Role.find_by(name: 'Agent').id).sort }
|
||||||
|
|
||||||
trait :with_org do
|
trait :with_org do
|
||||||
organization
|
organization
|
||||||
|
|
|
@ -42,7 +42,7 @@ RSpec.describe CommunicateTwitterJob, type: :job, required_envs: %w[TWITTER_CONS
|
||||||
|
|
||||||
expect(WebMock)
|
expect(WebMock)
|
||||||
.to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json')
|
.to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json')
|
||||||
.with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}" )
|
.with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'updates the article with tweet attributes' do
|
it 'updates the article with tweet attributes' do
|
||||||
|
@ -152,7 +152,7 @@ RSpec.describe CommunicateTwitterJob, type: :job, required_envs: %w[TWITTER_CONS
|
||||||
|
|
||||||
expect(WebMock)
|
expect(WebMock)
|
||||||
.to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json')
|
.to have_requested(:post, 'https://api.twitter.com/1.1/statuses/update.json')
|
||||||
.with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}" )
|
.with(body: "in_reply_to_status_id&status=#{CGI.escape(article.body)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,7 +90,7 @@ RSpec.describe TriggerWebhookJob, type: :job do
|
||||||
context 'with trigger token configured' do
|
context 'with trigger token configured' do
|
||||||
it 'includes X-Hub-Signature header' do
|
it 'includes X-Hub-Signature header' do
|
||||||
expect(WebMock).to have_requested(:post, endpoint)
|
expect(WebMock).to have_requested(:post, endpoint)
|
||||||
.with( body: payload, headers: headers )
|
.with(body: payload, headers: headers)
|
||||||
.with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) }
|
.with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) }
|
||||||
.with { |req| req.headers['X-Hub-Signature'].is_a?(String) }
|
.with { |req| req.headers['X-Hub-Signature'].is_a?(String) }
|
||||||
end
|
end
|
||||||
|
@ -101,7 +101,7 @@ RSpec.describe TriggerWebhookJob, type: :job do
|
||||||
|
|
||||||
it "doesn't include X-Hub-Signature header" do
|
it "doesn't include X-Hub-Signature header" do
|
||||||
expect(WebMock).to have_requested(:post, endpoint)
|
expect(WebMock).to have_requested(:post, endpoint)
|
||||||
.with( body: payload, headers: headers )
|
.with(body: payload, headers: headers)
|
||||||
.with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) }
|
.with { |req| req.headers['X-Zammad-Delivery'].is_a?(String) }
|
||||||
.with { |req| !req.headers.key?('X-Hub-Signature') }
|
.with { |req| !req.headers.key?('X-Hub-Signature') }
|
||||||
end
|
end
|
||||||
|
|
|
@ -108,7 +108,7 @@ RSpec.describe ExternalCredential::Google do
|
||||||
.to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
.to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
||||||
stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {})
|
stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates a Channel instance' do
|
it 'creates a Channel instance' do
|
||||||
|
@ -157,7 +157,7 @@ RSpec.describe ExternalCredential::Google do
|
||||||
before do
|
before do
|
||||||
stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {})
|
stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'failed attempt' do
|
shared_examples 'failed attempt' do
|
||||||
|
@ -208,7 +208,7 @@ RSpec.describe ExternalCredential::Google do
|
||||||
stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
||||||
stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {})
|
stub_request(:get, alias_url).to_return(status: 200, body: alias_response_payload.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
channel = described_class.link_account(request_token, authorization_payload)
|
channel = described_class.link_account(request_token, authorization_payload)
|
||||||
|
|
||||||
# remove stubs and allow new stubbing for tested requests
|
# remove stubs and allow new stubbing for tested requests
|
||||||
|
@ -318,7 +318,7 @@ RSpec.describe ExternalCredential::Google do
|
||||||
|
|
||||||
describe '.request_account_to_link' do
|
describe '.request_account_to_link' do
|
||||||
it 'generates authorize_url from credentials' do
|
it 'generates authorize_url from credentials' do
|
||||||
google = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
google = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
request = described_class.request_account_to_link(google.credentials)
|
request = described_class.request_account_to_link(google.credentials)
|
||||||
|
|
||||||
expect(request[:authorize_url]).to eq(authorize_url)
|
expect(request[:authorize_url]).to eq(authorize_url)
|
||||||
|
|
|
@ -74,7 +74,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
||||||
.with(body: hash_including(request_payload))
|
.with(body: hash_including(request_payload))
|
||||||
.to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
.to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates a Channel instance' do
|
it 'creates a Channel instance' do
|
||||||
|
@ -122,7 +122,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
||||||
before do
|
before do
|
||||||
stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {})
|
stub_request(:post, token_url).to_return(status: response_status, body: response_payload&.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'failed attempt' do
|
shared_examples 'failed attempt' do
|
||||||
|
@ -172,7 +172,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
||||||
let!(:channel) do
|
let!(:channel) do
|
||||||
stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
stub_request(:post, token_url).to_return(status: 200, body: token_response_payload.to_json, headers: {})
|
||||||
|
|
||||||
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
channel = described_class.link_account(request_token, authorization_payload)
|
channel = described_class.link_account(request_token, authorization_payload)
|
||||||
|
|
||||||
# remove stubs and allow new stubbing for tested requests
|
# remove stubs and allow new stubbing for tested requests
|
||||||
|
@ -282,7 +282,7 @@ RSpec.describe ExternalCredential::Microsoft365 do
|
||||||
|
|
||||||
describe '.request_account_to_link' do
|
describe '.request_account_to_link' do
|
||||||
it 'generates authorize_url from credentials' do
|
it 'generates authorize_url from credentials' do
|
||||||
microsoft365 = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret } )
|
microsoft365 = create(:external_credential, name: provider, credentials: { client_id: client_id, client_secret: client_secret })
|
||||||
request = described_class.request_account_to_link(microsoft365.credentials)
|
request = described_class.request_account_to_link(microsoft365.credentials)
|
||||||
|
|
||||||
expect(request[:authorize_url]).to eq(authorize_url)
|
expect(request[:authorize_url]).to eq(authorize_url)
|
||||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe Import::Helper do
|
||||||
it 'checks if import_mode is active' do
|
it 'checks if import_mode is active' do
|
||||||
allow(Setting).to receive(:get).with('import_mode').and_return(true)
|
allow(Setting).to receive(:get).with('import_mode').and_return(true)
|
||||||
|
|
||||||
expect( described_class.check_import_mode ).to be true
|
expect(described_class.check_import_mode).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'throws an exception if import_mode is disabled' do
|
it 'throws an exception if import_mode is disabled' do
|
||||||
|
@ -26,7 +26,7 @@ RSpec.describe Import::Helper do
|
||||||
it 'checks if system_init_done is active' do
|
it 'checks if system_init_done is active' do
|
||||||
allow(Setting).to receive(:get).with('system_init_done').and_return(false)
|
allow(Setting).to receive(:get).with('system_init_done').and_return(false)
|
||||||
|
|
||||||
expect( described_class.check_system_init_done ).to be true
|
expect(described_class.check_system_init_done).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'throws an exception if system_init_done is disabled' do
|
it 'throws an exception if system_init_done is disabled' do
|
||||||
|
|
|
@ -106,7 +106,7 @@ RSpec.describe NotificationFactory::Mailer do
|
||||||
let(:user) { create(:agent, email: 'somebody@example.com') }
|
let(:user) { create(:agent, email: 'somebody@example.com') }
|
||||||
|
|
||||||
it 'returns a Mail::Message' do
|
it 'returns a Mail::Message' do
|
||||||
expect( result ).to be_kind_of(Mail::Message)
|
expect(result).to be_kind_of(Mail::Message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ returns
|
||||||
|
|
||||||
# Regression test for issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found
|
# Regression test for issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found
|
||||||
it 'correctly handles missing tickets' do
|
it 'correctly handles missing tickets' do
|
||||||
class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] } ).as_stubbed_const
|
class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] }).as_stubbed_const
|
||||||
|
|
||||||
expect do
|
expect do
|
||||||
described_class.items(
|
described_class.items(
|
||||||
|
|
|
@ -606,7 +606,7 @@ RSpec.describe SecureMailing::SMIME do
|
||||||
end
|
end
|
||||||
|
|
||||||
let!(:article) do
|
let!(:article) do
|
||||||
_ticket, article, _user, _mail = Channel::EmailParser.new.process({}, mail['raw'] )
|
_ticket, article, _user, _mail = Channel::EmailParser.new.process({}, mail['raw'])
|
||||||
article
|
article
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Agent, sequencer: :sequ
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets user roles correctly for admin user' do
|
it 'sets user roles correctly for admin user' do
|
||||||
allow( Sequencer::Unit::Import::Freshdesk::Agent::Mapping).to receive(:admin_id).and_return(1001)
|
allow(Sequencer::Unit::Import::Freshdesk::Agent::Mapping).to receive(:admin_id).and_return(1001)
|
||||||
process(process_payload)
|
process(process_payload)
|
||||||
expect(User.last.roles.sort.map(&:name)).to eq %w[Admin Agent]
|
expect(User.last.roles.sort.map(&:name)).to eq %w[Admin Agent]
|
||||||
end
|
end
|
||||||
|
|
|
@ -157,7 +157,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::TicketField, sequencer:
|
||||||
|
|
||||||
it 'the custom field has type "tel"' do
|
it 'the custom field has type "tel"' do
|
||||||
process(process_payload)
|
process(process_payload)
|
||||||
expect( ObjectManager::Attribute.find_by(name: 'cf_custom_phone_number').data_option ).to include( 'type' => 'tel' )
|
expect(ObjectManager::Attribute.find_by(name: 'cf_custom_phone_number').data_option).to include('type' => 'tel')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::TicketField, sequencer:
|
||||||
|
|
||||||
it 'the custom field has type "url"' do
|
it 'the custom field has type "url"' do
|
||||||
process(process_payload)
|
process(process_payload)
|
||||||
expect( ObjectManager::Attribute.find_by(name: 'cf_custom_url').data_option ).to include( 'type' => 'url' )
|
expect(ObjectManager::Attribute.find_by(name: 'cf_custom_url').data_option).to include('type' => 'url')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do
|
||||||
ticket1 = create(:ticket)
|
ticket1 = create(:ticket)
|
||||||
ticket2 = create(:ticket)
|
ticket2 = create(:ticket)
|
||||||
|
|
||||||
ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 )
|
ticket1.merge_to(ticket_id: ticket2.id, user_id: 1)
|
||||||
|
|
||||||
mail = {
|
mail = {
|
||||||
'x-zammad-ticket-id': ticket1.id
|
'x-zammad-ticket-id': ticket1.id
|
||||||
|
@ -26,8 +26,8 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do
|
||||||
ticket2 = create(:ticket)
|
ticket2 = create(:ticket)
|
||||||
ticket3 = create(:ticket)
|
ticket3 = create(:ticket)
|
||||||
|
|
||||||
ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 )
|
ticket1.merge_to(ticket_id: ticket2.id, user_id: 1)
|
||||||
ticket2.merge_to( ticket_id: ticket3.id, user_id: 1 )
|
ticket2.merge_to(ticket_id: ticket3.id, user_id: 1)
|
||||||
|
|
||||||
mail = {
|
mail = {
|
||||||
'x-zammad-ticket-id': ticket1.id
|
'x-zammad-ticket-id': ticket1.id
|
||||||
|
@ -44,9 +44,9 @@ RSpec.describe Channel::Filter::FollowUpMerged, type: :channel_filter do
|
||||||
ticket3 = create(:ticket)
|
ticket3 = create(:ticket)
|
||||||
ticket4 = create(:ticket)
|
ticket4 = create(:ticket)
|
||||||
|
|
||||||
ticket1.merge_to( ticket_id: ticket2.id, user_id: 1 )
|
ticket1.merge_to(ticket_id: ticket2.id, user_id: 1)
|
||||||
ticket2.merge_to( ticket_id: ticket3.id, user_id: 1 )
|
ticket2.merge_to(ticket_id: ticket3.id, user_id: 1)
|
||||||
ticket3.merge_to( ticket_id: ticket4.id, user_id: 1 )
|
ticket3.merge_to(ticket_id: ticket4.id, user_id: 1)
|
||||||
|
|
||||||
mail = {
|
mail = {
|
||||||
'x-zammad-ticket-id': ticket2.id
|
'x-zammad-ticket-id': ticket2.id
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Cti::Driver::Base do
|
RSpec.describe Cti::Driver::Base do
|
||||||
subject!(:driver) { described_class.new(mapping: {}, params: params, config: config ) }
|
subject!(:driver) { described_class.new(mapping: {}, params: params, config: config) }
|
||||||
|
|
||||||
let(:direction) { 'in' }
|
let(:direction) { 'in' }
|
||||||
let(:event) { 'newCall' }
|
let(:event) { 'newCall' }
|
||||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe Session, type: :model do
|
||||||
|
|
||||||
describe 'Check that session creation' do
|
describe 'Check that session creation' do
|
||||||
context 'without persistent flag in data payload' do
|
context 'without persistent flag in data payload' do
|
||||||
subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: {} ) }
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: {}) }
|
||||||
|
|
||||||
it 'does not set the persistent attribute' do
|
it 'does not set the persistent attribute' do
|
||||||
expect(session.persistent).to be_nil
|
expect(session.persistent).to be_nil
|
||||||
|
@ -14,7 +14,7 @@ RSpec.describe Session, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with true persistent flag in data payload' do
|
context 'with true persistent flag in data payload' do
|
||||||
subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => true }) }
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => true }) }
|
||||||
|
|
||||||
it 'sets the persistent attribute in the session and removes the persistent attribute from the data payload' do
|
it 'sets the persistent attribute in the session and removes the persistent attribute from the data payload' do
|
||||||
expect(session.persistent).to eq(true)
|
expect(session.persistent).to eq(true)
|
||||||
|
@ -23,7 +23,7 @@ RSpec.describe Session, type: :model do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with false persistent flag in data payload' do
|
context 'with false persistent flag in data payload' do
|
||||||
subject(:session) { described_class.create( session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) }
|
subject(:session) { described_class.create(session_id: SecureRandom.urlsafe_base64(64), data: { 'persistent' => false }) }
|
||||||
|
|
||||||
it 'does not set the persistent attribute' do
|
it 'does not set the persistent attribute' do
|
||||||
expect(session.persistent).to be_nil
|
expect(session.persistent).to be_nil
|
||||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe Ticket::Article::AddsMetadataGeneral do
|
||||||
|
|
||||||
context 'when Agent creates Article' do
|
context 'when Agent creates Article' do
|
||||||
shared_examples 'not including email in from' do |factory|
|
shared_examples 'not including email in from' do |factory|
|
||||||
subject(:article) { create(:ticket_article, factory, ticket: ticket, created_by_id: agent.id, updated_by_id: agent.id ) }
|
subject(:article) { create(:ticket_article, factory, ticket: ticket, created_by_id: agent.id, updated_by_id: agent.id) }
|
||||||
|
|
||||||
let(:ticket) { create(:ticket) }
|
let(:ticket) { create(:ticket) }
|
||||||
let!(:agent) { create(:agent, groups: [ticket.group]) }
|
let!(:agent) { create(:agent, groups: [ticket.group]) }
|
||||||
|
|
|
@ -615,7 +615,7 @@ RSpec.describe Ticket::Article, type: :model do
|
||||||
article_new = create(:ticket_article)
|
article_new = create(:ticket_article)
|
||||||
UserInfo.current_user_id = 1
|
UserInfo.current_user_id = 1
|
||||||
|
|
||||||
attachments = article_parent.clone_attachments(article_new.class.name, article_new.id, only_inline_attachments: true )
|
attachments = article_parent.clone_attachments(article_new.class.name, article_new.id, only_inline_attachments: true)
|
||||||
|
|
||||||
expect(attachments.count).to eq(1)
|
expect(attachments.count).to eq(1)
|
||||||
expect(attachments[0].filename).to eq('some_file1.jpg')
|
expect(attachments[0].filename).to eq('some_file1.jpg')
|
||||||
|
|
|
@ -1250,13 +1250,13 @@ RSpec.describe Ticket, type: :model do
|
||||||
|
|
||||||
shared_examples 'permitted' do
|
shared_examples 'permitted' do
|
||||||
it 'finds Ticket' do
|
it 'finds Ticket' do
|
||||||
expect( described_class.search(query: ticket.number, current_user: current_user).count ).to eq(1)
|
expect(described_class.search(query: ticket.number, current_user: current_user).count).to eq(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'no permission' do
|
shared_examples 'no permission' do
|
||||||
it "doesn't find Ticket" do
|
it "doesn't find Ticket" do
|
||||||
expect( described_class.search(query: ticket.number, current_user: current_user) ).to be_blank
|
expect(described_class.search(query: ticket.number, current_user: current_user)).to be_blank
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ RSpec.describe 'External Credentials', type: :request do
|
||||||
|
|
||||||
expect(WebMock)
|
expect(WebMock)
|
||||||
.to have_requested(:post, "https://api.twitter.com/1.1/account_activity/all/#{env_name}/webhooks.json")
|
.to have_requested(:post, "https://api.twitter.com/1.1/account_activity/all/#{env_name}/webhooks.json")
|
||||||
.with(body: "url=#{CGI.escape(webhook_url)}" )
|
.with(body: "url=#{CGI.escape(webhook_url)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ RSpec.describe 'External Credentials', type: :request do
|
||||||
|
|
||||||
expect(WebMock)
|
expect(WebMock)
|
||||||
.to have_requested(:post, 'https://api.twitter.com/oauth/request_token')
|
.to have_requested(:post, 'https://api.twitter.com/oauth/request_token')
|
||||||
.with(headers: { 'Authorization' => %r{oauth_consumer_key="#{twitter_credential.credentials[:consumer_key]}"} } )
|
.with(headers: { 'Authorization' => %r{oauth_consumer_key="#{twitter_credential.credentials[:consumer_key]}"} })
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to Twitter authorization URL' do
|
it 'redirects to Twitter authorization URL' do
|
||||||
|
|
|
@ -612,7 +612,7 @@ RSpec.describe 'Monitoring', type: :request do
|
||||||
expect(json_response['message']).to be_truthy
|
expect(json_response['message']).to be_truthy
|
||||||
expect(json_response['issues']).to be_truthy
|
expect(json_response['issues']).to be_truthy
|
||||||
expect(json_response['healthy']).to eq(false)
|
expect(json_response['healthy']).to eq(false)
|
||||||
expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).")
|
expect(json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).")
|
||||||
|
|
||||||
# add another job
|
# add another job
|
||||||
manual_added = SearchIndexJob.perform_later('Ticket', 1)
|
manual_added = SearchIndexJob.perform_later('Ticket', 1)
|
||||||
|
@ -626,7 +626,7 @@ RSpec.describe 'Monitoring', type: :request do
|
||||||
expect(json_response['message']).to be_truthy
|
expect(json_response['message']).to be_truthy
|
||||||
expect(json_response['issues']).to be_truthy
|
expect(json_response['issues']).to be_truthy
|
||||||
expect(json_response['healthy']).to eq(false)
|
expect(json_response['healthy']).to eq(false)
|
||||||
expect( json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 10 attempt(s).")
|
expect(json_response['message']).to eq("Failed to run background job #1 'SearchIndexAssociationsJob' 1 time(s) with 1 attempt(s).;Failed to run background job #2 'SearchIndexJob' 1 time(s) with 10 attempt(s).")
|
||||||
|
|
||||||
# add another job
|
# add another job
|
||||||
dummy_class = Class.new(ApplicationJob) do
|
dummy_class = Class.new(ApplicationJob) do
|
||||||
|
@ -636,7 +636,7 @@ RSpec.describe 'Monitoring', type: :request do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
manual_added = Delayed::Job.enqueue( dummy_class.new )
|
manual_added = Delayed::Job.enqueue(dummy_class.new)
|
||||||
manual_added.update!(attempts: 5)
|
manual_added.update!(attempts: 5)
|
||||||
|
|
||||||
# health_check
|
# health_check
|
||||||
|
@ -654,7 +654,7 @@ RSpec.describe 'Monitoring', type: :request do
|
||||||
|
|
||||||
# add some more failing job
|
# add some more failing job
|
||||||
10.times do
|
10.times do
|
||||||
manual_added = Delayed::Job.enqueue( dummy_class.new )
|
manual_added = Delayed::Job.enqueue(dummy_class.new)
|
||||||
manual_added.update!(attempts: 5)
|
manual_added.update!(attempts: 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ RSpec.describe 'LongPolling', type: :request do
|
||||||
|
|
||||||
# here we use a token for the authentication because the basic auth way with username and password
|
# here we use a token for the authentication because the basic auth way with username and password
|
||||||
# will update the user by every request and return a different result for the test
|
# will update the user by every request and return a different result for the test
|
||||||
authenticated_as(agent, token: create(:token, action: 'api', user_id: agent.id) )
|
authenticated_as(agent, token: create(:token, action: 'api', user_id: agent.id))
|
||||||
get '/api/v1/message_send', params: { data: { event: 'login' } }, as: :json
|
get '/api/v1/message_send', params: { data: { event: 'login' } }, as: :json
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
expect(json_response['client_id'].to_i).to be_between(1, 9_999_999_999)
|
expect(json_response['client_id'].to_i).to be_between(1, 9_999_999_999)
|
||||||
|
|
|
@ -54,7 +54,7 @@ RSpec.describe 'Report', type: :request, searchindex: true do
|
||||||
create(:ticket, title: 'ticket for report #1', created_at: today.midday)
|
create(:ticket, title: 'ticket for report #1', created_at: today.midday)
|
||||||
create(:ticket, title: 'ticket for report #2', created_at: today.midday + 2.hours)
|
create(:ticket, title: 'ticket for report #2', created_at: today.midday + 2.hours)
|
||||||
create(:ticket, title: 'ticket for report #3', created_at: today.midday + 2.hours)
|
create(:ticket, title: 'ticket for report #3', created_at: today.midday + 2.hours)
|
||||||
create(:ticket, title: 'ticket for report #4', created_at: today.midday + 10.hours, state: Ticket::State.lookup(name: 'closed') )
|
create(:ticket, title: 'ticket for report #4', created_at: today.midday + 10.hours, state: Ticket::State.lookup(name: 'closed'))
|
||||||
create(:ticket, title: 'ticket for report #5', created_at: today.midday + 11.hours)
|
create(:ticket, title: 'ticket for report #5', created_at: today.midday + 11.hours)
|
||||||
create(:ticket, title: 'ticket for report #6', created_at: today.midday - 11.hours)
|
create(:ticket, title: 'ticket for report #6', created_at: today.midday - 11.hours)
|
||||||
create(:ticket, title: 'ticket for report #7', created_at: Time.zone.parse('2019-02-28T23:30:00Z'))
|
create(:ticket, title: 'ticket for report #7', created_at: Time.zone.parse('2019-02-28T23:30:00Z'))
|
||||||
|
|
|
@ -28,7 +28,7 @@ RSpec.describe Tag, type: :request do
|
||||||
it "found 1 tag using search term '#{search_term}'" do
|
it "found 1 tag using search term '#{search_term}'" do
|
||||||
get '/api/v1/tag_search', params: { term: search_term }
|
get '/api/v1/tag_search', params: { term: search_term }
|
||||||
expect(response).to have_http_status(:ok)
|
expect(response).to have_http_status(:ok)
|
||||||
expect(json_response).to contain_exactly( 'id' => foobar_tag.id, 'value' => foobar_tag.name )
|
expect(json_response).to contain_exactly('id' => foobar_tag.id, 'value' => foobar_tag.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -530,25 +530,25 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
|
||||||
let(:article_communication) do
|
let(:article_communication) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', type_name: 'email', ticket: ticket,
|
sender_name: 'Agent', type_name: 'email', ticket: ticket,
|
||||||
updated_by_id: agent.id, created_by_id: agent.id )
|
updated_by_id: agent.id, created_by_id: agent.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_self) do
|
let(:article_note_self) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
||||||
updated_by_id: user.id, created_by_id: user.id )
|
updated_by_id: user.id, created_by_id: user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_other) do
|
let(:article_note_other) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note', ticket: ticket,
|
||||||
updated_by_id: other_agent.id, created_by_id: other_agent.id )
|
updated_by_id: other_agent.id, created_by_id: other_agent.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_customer) do
|
let(:article_note_customer) do
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Customer', internal: false, type_name: 'note', ticket: ticket,
|
sender_name: 'Customer', internal: false, type_name: 'note', ticket: ticket,
|
||||||
updated_by_id: customer.id, created_by_id: customer.id )
|
updated_by_id: customer.id, created_by_id: customer.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_communication_self) do
|
let(:article_note_communication_self) do
|
||||||
|
@ -556,7 +556,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
|
||||||
|
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
||||||
updated_by_id: user.id, created_by_id: user.id )
|
updated_by_id: user.id, created_by_id: user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:article_note_communication_other) do
|
let(:article_note_communication_other) do
|
||||||
|
@ -564,7 +564,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
|
||||||
|
|
||||||
create(:ticket_article,
|
create(:ticket_article,
|
||||||
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
sender_name: 'Agent', internal: true, type_name: 'note_communication', ticket: ticket,
|
||||||
updated_by_id: other_agent.id, created_by_id: other_agent.id )
|
updated_by_id: other_agent.id, created_by_id: other_agent.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_article_via_rest(article)
|
def delete_article_via_rest(article)
|
||||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe 'Ticket Escalation', type: :request do
|
||||||
let(:sla_update) { 3.hours }
|
let(:sla_update) { 3.hours }
|
||||||
let(:sla_close) { 4.hours }
|
let(:sla_close) { 4.hours }
|
||||||
|
|
||||||
let!(:mail_group) { create(:group, email_address: create(:email_address) ) }
|
let!(:mail_group) { create(:group, email_address: create(:email_address)) }
|
||||||
|
|
||||||
let(:calendar) { create(:calendar, :'24/7') }
|
let(:calendar) { create(:calendar, :'24/7') }
|
||||||
let(:sla) do
|
let(:sla) do
|
||||||
|
|
|
@ -5,10 +5,10 @@ require 'rails_helper'
|
||||||
RSpec.describe 'Ticket', type: :request do
|
RSpec.describe 'Ticket', type: :request do
|
||||||
|
|
||||||
let!(:ticket_group) do
|
let!(:ticket_group) do
|
||||||
create(:group, email_address: create(:email_address) )
|
create(:group, email_address: create(:email_address))
|
||||||
end
|
end
|
||||||
let!(:ticket_group_without_create) do
|
let!(:ticket_group_without_create) do
|
||||||
create(:group, email_address: create(:email_address) )
|
create(:group, email_address: create(:email_address))
|
||||||
end
|
end
|
||||||
let(:admin) do
|
let(:admin) do
|
||||||
create(:admin, groups: Group.all, firstname: 'Tickets', lastname: 'Admin')
|
create(:admin, groups: Group.all, firstname: 'Tickets', lastname: 'Admin')
|
||||||
|
|
|
@ -27,8 +27,8 @@ RSpec.describe 'Time Accounting API endpoints', type: :request do
|
||||||
context 'when requesting a log report download' do
|
context 'when requesting a log report download' do
|
||||||
it 'responds with an Excel spreadsheet' do
|
it 'responds with an Excel spreadsheet' do
|
||||||
create(:group)
|
create(:group)
|
||||||
ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer )
|
ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer)
|
||||||
article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note') )
|
article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note'))
|
||||||
|
|
||||||
create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id)
|
create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id)
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ RSpec.describe 'Time Accounting API endpoints', type: :request do
|
||||||
ObjectManager::Attribute.add attributes_for :object_manager_attribute_select
|
ObjectManager::Attribute.add attributes_for :object_manager_attribute_select
|
||||||
|
|
||||||
create(:group)
|
create(:group)
|
||||||
ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer )
|
ticket = create(:ticket, state: Ticket::State.lookup(name: 'open'), customer: customer)
|
||||||
article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note') )
|
article = create(:ticket_article, ticket: ticket, type: Ticket::Article::Type.lookup(name: 'note'))
|
||||||
|
|
||||||
create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id)
|
create(:ticket_time_accounting, ticket_id: ticket.id, ticket_article_id: article.id)
|
||||||
|
|
||||||
|
|
|
@ -1150,8 +1150,8 @@ RSpec.describe 'User', type: :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:successful_params) { { email: attributes_for(:admin)[:email] } }
|
let(:successful_params) { { email: attributes_for(:admin)[:email] } }
|
||||||
let(:params_with_role) { successful_params.merge({ role_ids: [Role.find_by(name: 'Admin').id] } ) }
|
let(:params_with_role) { successful_params.merge({ role_ids: [Role.find_by(name: 'Admin').id] }) }
|
||||||
let(:params_with_invite) { successful_params.merge({ invite: true } ) }
|
let(:params_with_invite) { successful_params.merge({ invite: true }) }
|
||||||
|
|
||||||
it 'succeeds' do
|
it 'succeeds' do
|
||||||
make_request successful_params
|
make_request successful_params
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
# The API key is used only inside the base64 encoded Basic Auth string, so mask that as well.
|
# The API key is used only inside the base64 encoded Basic Auth string, so mask that as well.
|
||||||
VCR.configure do |c|
|
VCR.configure do |c|
|
||||||
c.filter_sensitive_data('<IMPORT_FRESHDESK_ENDPOINT_BASIC_AUTH>') { Base64.encode64( "#{ENV['IMPORT_FRESHDESK_ENDPOINT_KEY']}:X" ).chomp }
|
c.filter_sensitive_data('<IMPORT_FRESHDESK_ENDPOINT_BASIC_AUTH>') { Base64.encode64("#{ENV['IMPORT_FRESHDESK_ENDPOINT_KEY']}:X").chomp }
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,7 +36,7 @@ RSpec.describe 'Caller log', type: %i[system request], authenticated_as: true do
|
||||||
visit 'cti'
|
visit 'cti'
|
||||||
|
|
||||||
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json
|
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json
|
||||||
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111' ), as: :json
|
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111'), as: :json
|
||||||
|
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
expect(page).to have_text('New Ticket', wait: 5)
|
expect(page).to have_text('New Ticket', wait: 5)
|
||||||
|
@ -53,7 +53,7 @@ RSpec.describe 'Caller log', type: %i[system request], authenticated_as: true do
|
||||||
visit 'cti'
|
visit 'cti'
|
||||||
|
|
||||||
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json
|
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'newCall'), as: :json
|
||||||
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111' ), as: :json
|
post "#{Capybara.app_host}/api/v1/cti/token1234", params: params.merge(event: 'answer', answeringNumber: '0190111'), as: :json
|
||||||
|
|
||||||
within(:active_content) do
|
within(:active_content) do
|
||||||
expect(page).to have_text(customer.fullname, wait: 5)
|
expect(page).to have_text(customer.fullname, wait: 5)
|
||||||
|
|
|
@ -13,7 +13,7 @@ RSpec.describe 'Profile', type: :system do
|
||||||
|
|
||||||
context 'when user is an agent with no user_preferences permission', authenticated_as: :new_user do
|
context 'when user is an agent with no user_preferences permission', authenticated_as: :new_user do
|
||||||
let(:role) { create(:role, permissions: [Permission.find_by(name: 'ticket.agent')]) }
|
let(:role) { create(:role, permissions: [Permission.find_by(name: 'ticket.agent')]) }
|
||||||
let(:new_user) { create(:user, roles: [role] ) }
|
let(:new_user) { create(:user, roles: [role]) }
|
||||||
|
|
||||||
it 'does not show profile link in navigation' do
|
it 'does not show profile link in navigation' do
|
||||||
visit 'dashboard'
|
visit 'dashboard'
|
||||||
|
|
|
@ -40,10 +40,10 @@ RSpec.describe 'Manage > Integration > S/MIME', type: :system do
|
||||||
expect(page).to have_css('td', text: 'Including private key')
|
expect(page).to have_css('td', text: 'Including private key')
|
||||||
|
|
||||||
# check result
|
# check result
|
||||||
expect( Setting.get('smime_integration') ).to be true
|
expect(Setting.get('smime_integration')).to be true
|
||||||
expect( SMIMECertificate.last.fingerprint ).to be_present
|
expect(SMIMECertificate.last.fingerprint).to be_present
|
||||||
expect( SMIMECertificate.last.raw ).to be_present
|
expect(SMIMECertificate.last.raw).to be_present
|
||||||
expect( SMIMECertificate.last.private_key ).to be_present
|
expect(SMIMECertificate.last.private_key).to be_present
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'adding of multiple certificates at once' do
|
it 'adding of multiple certificates at once' do
|
||||||
|
|
|
@ -991,8 +991,8 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as agent with full permissions' do
|
context 'as agent with full permissions' do
|
||||||
let(:current_user) { create(:agent, groups: [ group_users ] ) }
|
let(:current_user) { create(:agent, groups: [ group_users ]) }
|
||||||
let(:ticket) { create(:ticket, group: group_users ) }
|
let(:ticket) { create(:ticket, group: group_users) }
|
||||||
|
|
||||||
include_examples 'shows attributes and values for agent view and editable'
|
include_examples 'shows attributes and values for agent view and editable'
|
||||||
end
|
end
|
||||||
|
@ -1024,16 +1024,16 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as agent+customer with full permissions' do
|
context 'as agent+customer with full permissions' do
|
||||||
let!(:current_user) { create(:agent_and_customer, groups: [ group_users ] ) }
|
let!(:current_user) { create(:agent_and_customer, groups: [ group_users ]) }
|
||||||
|
|
||||||
context 'normal ticket' do
|
context 'normal ticket' do
|
||||||
let(:ticket) { create(:ticket, group: group_users ) }
|
let(:ticket) { create(:ticket, group: group_users) }
|
||||||
|
|
||||||
include_examples 'shows attributes and values for agent view and editable'
|
include_examples 'shows attributes and values for agent view and editable'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'ticket where current_user is also customer' do
|
context 'ticket where current_user is also customer' do
|
||||||
let(:ticket) { create(:ticket, customer: current_user, group: group_users ) }
|
let(:ticket) { create(:ticket, customer: current_user, group: group_users) }
|
||||||
|
|
||||||
include_examples 'shows attributes and values for agent view and editable'
|
include_examples 'shows attributes and values for agent view and editable'
|
||||||
end
|
end
|
||||||
|
|
|
@ -818,13 +818,13 @@ class AdminObjectManagerTest < TestCase
|
||||||
|
|
||||||
ticket_open_by_title(title: 'select')
|
ticket_open_by_title(title: 'select')
|
||||||
|
|
||||||
click( css: '.content.active .tabsSidebar-tab[data-tab="organization"]' )
|
click(css: '.content.active .tabsSidebar-tab[data-tab="organization"]')
|
||||||
click( css: '.content.active .sidebar[data-tab="organization"] .js-actions .dropdown-toggle' )
|
click(css: '.content.active .sidebar[data-tab="organization"] .js-actions .dropdown-toggle')
|
||||||
click( css: '.content.active .sidebar[data-tab="organization"] .js-actions [data-type="organization-edit"]' )
|
click(css: '.content.active .sidebar[data-tab="organization"] .js-actions [data-type="organization-edit"]')
|
||||||
|
|
||||||
modal_ready
|
modal_ready
|
||||||
select(css: '.content.active .modal select[name="bool_test"]', value: 'NO')
|
select(css: '.content.active .modal select[name="bool_test"]', value: 'NO')
|
||||||
click( css: '.content.active .modal .js-submit' )
|
click(css: '.content.active .modal .js-submit')
|
||||||
modal_disappear
|
modal_disappear
|
||||||
|
|
||||||
watch_for(
|
watch_for(
|
||||||
|
@ -894,13 +894,13 @@ class AdminObjectManagerTest < TestCase
|
||||||
|
|
||||||
ticket_open_by_title(title: 'select')
|
ticket_open_by_title(title: 'select')
|
||||||
|
|
||||||
click( css: '.content.active .tabsSidebar-tab[data-tab="customer"]' )
|
click(css: '.content.active .tabsSidebar-tab[data-tab="customer"]')
|
||||||
click( css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle' )
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
||||||
click( css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]' )
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
|
||||||
|
|
||||||
modal_ready
|
modal_ready
|
||||||
select(css: '.content.active .modal select[name="bool_test"]', value: 'NO')
|
select(css: '.content.active .modal select[name="bool_test"]', value: 'NO')
|
||||||
click( css: '.content.active .modal .js-submit' )
|
click(css: '.content.active .modal .js-submit')
|
||||||
modal_disappear
|
modal_disappear
|
||||||
|
|
||||||
watch_for(
|
watch_for(
|
||||||
|
|
|
@ -123,7 +123,7 @@ class AdminOverviewTest < TestCase
|
||||||
def ordered_ticket_titles(ticket_titles)
|
def ordered_ticket_titles(ticket_titles)
|
||||||
ticket_titles.map do |title|
|
ticket_titles.map do |title|
|
||||||
[title,
|
[title,
|
||||||
get_location( css: "td[title='#{title}']").y]
|
get_location(css: "td[title='#{title}']").y]
|
||||||
end.sort_by { |x| x[1] }.map { |x| x[0] }
|
end.sort_by { |x| x[1] }.map { |x| x[0] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -140,11 +140,11 @@ class AdminOverviewTest < TestCase
|
||||||
out_of_office_css = '.content.active .modal select[name="out_of_office"]'
|
out_of_office_css = '.content.active .modal select[name="out_of_office"]'
|
||||||
first_overview_css = '.content.active tr[data-id="1"] td'
|
first_overview_css = '.content.active tr[data-id="1"] td'
|
||||||
|
|
||||||
click( css: 'a[href="#manage"]' )
|
click(css: 'a[href="#manage"]')
|
||||||
click( css: '.content.active a[href="#manage/overviews"]' )
|
click(css: '.content.active a[href="#manage/overviews"]')
|
||||||
|
|
||||||
# round 1, open the overview and set out_of_office to true
|
# round 1, open the overview and set out_of_office to true
|
||||||
click( css: first_overview_css )
|
click(css: first_overview_css)
|
||||||
modal_ready
|
modal_ready
|
||||||
watch_for(
|
watch_for(
|
||||||
css: out_of_office_css,
|
css: out_of_office_css,
|
||||||
|
@ -154,11 +154,11 @@ class AdminOverviewTest < TestCase
|
||||||
css: out_of_office_css,
|
css: out_of_office_css,
|
||||||
value: 'yes',
|
value: 'yes',
|
||||||
)
|
)
|
||||||
click( css: '.content.active .modal .js-submit' )
|
click(css: '.content.active .modal .js-submit')
|
||||||
modal_disappear
|
modal_disappear
|
||||||
|
|
||||||
# round 2, open the overview and set out_of_office back to false
|
# round 2, open the overview and set out_of_office back to false
|
||||||
click( css: first_overview_css )
|
click(css: first_overview_css)
|
||||||
modal_ready
|
modal_ready
|
||||||
watch_for(
|
watch_for(
|
||||||
css: out_of_office_css,
|
css: out_of_office_css,
|
||||||
|
@ -168,17 +168,17 @@ class AdminOverviewTest < TestCase
|
||||||
css: out_of_office_css,
|
css: out_of_office_css,
|
||||||
value: 'no',
|
value: 'no',
|
||||||
)
|
)
|
||||||
click( css: '.content.active .modal .js-submit' )
|
click(css: '.content.active .modal .js-submit')
|
||||||
modal_disappear
|
modal_disappear
|
||||||
|
|
||||||
# round 3, open the overview and confirm that it's still false
|
# round 3, open the overview and confirm that it's still false
|
||||||
click( css: first_overview_css )
|
click(css: first_overview_css)
|
||||||
modal_ready
|
modal_ready
|
||||||
watch_for(
|
watch_for(
|
||||||
css: out_of_office_css,
|
css: out_of_office_css,
|
||||||
value: 'no',
|
value: 'no',
|
||||||
)
|
)
|
||||||
click( css: '.content.active .modal .js-submit' )
|
click(css: '.content.active .modal .js-submit')
|
||||||
modal_disappear
|
modal_disappear
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase
|
||||||
click(css: '.content.active .newTicket [name="customer_id_completion"]')
|
click(css: '.content.active .newTicket [name="customer_id_completion"]')
|
||||||
|
|
||||||
# check if pulldown is open, it's not working stable via selenium
|
# check if pulldown is open, it's not working stable via selenium
|
||||||
@browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" )
|
@browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')")
|
||||||
|
|
||||||
set(
|
set(
|
||||||
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
||||||
|
@ -110,7 +110,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase
|
||||||
click(css: '.content.active .newTicket [name="customer_id_completion"]')
|
click(css: '.content.active .newTicket [name="customer_id_completion"]')
|
||||||
|
|
||||||
# check if pulldown is open, it's not working stable via selenium
|
# check if pulldown is open, it's not working stable via selenium
|
||||||
@browser.execute_script( "$('.content.active .newTicket .js-recipientDropdown').addClass('open')" )
|
@browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')")
|
||||||
|
|
||||||
set(
|
set(
|
||||||
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
css: '.content.active .newTicket input[name="customer_id_completion"]',
|
||||||
|
|
|
@ -57,8 +57,8 @@ class AgentTicketMergeTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# merge tickets
|
# merge tickets
|
||||||
click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
|
click(css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down')
|
||||||
click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
|
click(css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]')
|
||||||
|
|
||||||
modal_ready
|
modal_ready
|
||||||
set(
|
set(
|
||||||
|
@ -66,7 +66,7 @@ class AgentTicketMergeTest < TestCase
|
||||||
value: ticket1[:number],
|
value: ticket1[:number],
|
||||||
)
|
)
|
||||||
|
|
||||||
click( css: '.modal button[type="submit"]' )
|
click(css: '.modal button[type="submit"]')
|
||||||
|
|
||||||
# check if merged to ticket is shown now
|
# check if merged to ticket is shown now
|
||||||
watch_for(
|
watch_for(
|
||||||
|
@ -111,15 +111,15 @@ class AgentTicketMergeTest < TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# merge tickets
|
# merge tickets
|
||||||
click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
|
click(css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down')
|
||||||
click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
|
click(css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]')
|
||||||
|
|
||||||
modal_ready
|
modal_ready
|
||||||
set(
|
set(
|
||||||
css: '.modal input[name="target_ticket_number"]',
|
css: '.modal input[name="target_ticket_number"]',
|
||||||
value: ticket3[:number],
|
value: ticket3[:number],
|
||||||
)
|
)
|
||||||
click( css: '.modal button[type="submit"]' )
|
click(css: '.modal button[type="submit"]')
|
||||||
|
|
||||||
# check if merged to ticket is shown now
|
# check if merged to ticket is shown now
|
||||||
watch_for(
|
watch_for(
|
||||||
|
|
|
@ -40,7 +40,7 @@ class AgentTicketTaskChangedTest < TestCase
|
||||||
tasks_close_all
|
tasks_close_all
|
||||||
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
exists_not( css: '.modal')
|
exists_not(css: '.modal')
|
||||||
|
|
||||||
object_manager_attribute_delete(
|
object_manager_attribute_delete(
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -785,7 +785,7 @@ class ChatNoJqueryTest < TestCase
|
||||||
timeout: 150,
|
timeout: 150,
|
||||||
)
|
)
|
||||||
|
|
||||||
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
|
agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click)
|
||||||
sleep 2
|
sleep 2
|
||||||
click(
|
click(
|
||||||
browser: customer,
|
browser: customer,
|
||||||
|
|
|
@ -785,7 +785,7 @@ class ChatTest < TestCase
|
||||||
timeout: 150,
|
timeout: 150,
|
||||||
)
|
)
|
||||||
|
|
||||||
agent.find_elements( { css: '.active .chat-window .js-close' } ).each(&:click)
|
agent.find_elements({ css: '.active .chat-window .js-close' }).each(&:click)
|
||||||
sleep 2
|
sleep 2
|
||||||
click(
|
click(
|
||||||
browser: customer,
|
browser: customer,
|
||||||
|
|
|
@ -64,7 +64,7 @@ class SettingTest < TestCase
|
||||||
css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
|
css: '[data-name="auth_facebook_credentials"] input[name=app_secret]',
|
||||||
value: 'secret_test1234äöüß',
|
value: 'secret_test1234äöüß',
|
||||||
)
|
)
|
||||||
click( css: '[data-name="auth_facebook_credentials"] button[type=submit]')
|
click(css: '[data-name="auth_facebook_credentials"] button[type=submit]')
|
||||||
watch_for(
|
watch_for(
|
||||||
css: '#notify',
|
css: '#notify',
|
||||||
value: 'update successful',
|
value: 'update successful',
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SwitchToUserTest < TestCase
|
||||||
)
|
)
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
@browser.action.move_to(@browser.find_elements({ css: '.content.active .table-overview tbody tr:first-child' } )[0]).release.perform
|
@browser.action.move_to(@browser.find_elements({ css: '.content.active .table-overview tbody tr:first-child' })[0]).release.perform
|
||||||
|
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
click(
|
click(
|
||||||
|
|
|
@ -3248,7 +3248,7 @@ wait untill text in selector disabppears
|
||||||
element.send_keys(data[:phone])
|
element.send_keys(data[:phone])
|
||||||
end
|
end
|
||||||
if data[:active].present?
|
if data[:active].present?
|
||||||
select(css: 'select[name="active"]', value: data[:active] ? 'active' : 'inactive' )
|
select(css: 'select[name="active"]', value: data[:active] ? 'active' : 'inactive')
|
||||||
end
|
end
|
||||||
|
|
||||||
if data[:organization]
|
if data[:organization]
|
||||||
|
|
|
@ -23,9 +23,9 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
if ENV['IMPORT_OTRS_ENDPOINT'] =~ %r{^(http|https)://}
|
if ENV['IMPORT_OTRS_ENDPOINT'] =~ %r{^(http|https)://}
|
||||||
http = $1
|
http = $1
|
||||||
end
|
end
|
||||||
assert( Setting.get('system_id'), 'system_id' )
|
assert(Setting.get('system_id'), 'system_id')
|
||||||
assert_equal( http, Setting.get('http_type'), 'http_type' )
|
assert_equal(http, Setting.get('http_type'), 'http_type')
|
||||||
assert_equal( 'Example Company', Setting.get('organization'), 'organization' )
|
assert_equal('Example Company', Setting.get('organization'), 'organization')
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'check dynamic fields' do
|
test 'check dynamic fields' do
|
||||||
|
@ -43,129 +43,129 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# check count of imported items
|
# check count of imported items
|
||||||
test 'check counts' do
|
test 'check counts' do
|
||||||
assert_equal( 603, Ticket.count, 'tickets' )
|
assert_equal(603, Ticket.count, 'tickets')
|
||||||
assert_equal( 3182, Ticket::Article.count, 'ticket articles' )
|
assert_equal(3182, Ticket::Article.count, 'ticket articles')
|
||||||
assert_equal( 274, Store.count, 'ticket article attachments' )
|
assert_equal(274, Store.count, 'ticket article attachments')
|
||||||
assert_equal( 10, Ticket::State.count, 'ticket states' )
|
assert_equal(10, Ticket::State.count, 'ticket states')
|
||||||
assert_equal( 24, Group.count, 'groups' )
|
assert_equal(24, Group.count, 'groups')
|
||||||
end
|
end
|
||||||
|
|
||||||
# check imported users and permission
|
# check imported users and permission
|
||||||
test 'check users' do
|
test 'check users' do
|
||||||
role_admin = Role.where( name: 'Admin' ).first
|
role_admin = Role.where(name: 'Admin').first
|
||||||
role_agent = Role.where( name: 'Agent' ).first
|
role_agent = Role.where(name: 'Agent').first
|
||||||
role_customer = Role.where( name: 'Customer' ).first
|
role_customer = Role.where(name: 'Customer').first
|
||||||
#role_report = Role.where( :name => 'Report' ).first
|
#role_report = Role.where( :name => 'Report' ).first
|
||||||
|
|
||||||
user1 = User.find(2)
|
user1 = User.find(2)
|
||||||
assert_equal( 'agent-1 firstname', user1.firstname )
|
assert_equal('agent-1 firstname', user1.firstname)
|
||||||
assert_equal( 'agent-1 lastname', user1.lastname )
|
assert_equal('agent-1 lastname', user1.lastname)
|
||||||
assert_equal( 'agent-1', user1.login )
|
assert_equal('agent-1', user1.login)
|
||||||
assert_equal( 'agent-1@example.com', user1.email )
|
assert_equal('agent-1@example.com', user1.email)
|
||||||
assert_equal( true, user1.active )
|
assert_equal(true, user1.active)
|
||||||
|
|
||||||
assert( user1.roles.include?( role_agent ) )
|
assert(user1.roles.include?(role_agent))
|
||||||
assert_not( user1.roles.include?( role_admin ) )
|
assert_not(user1.roles.include?(role_admin))
|
||||||
assert_not( user1.roles.include?( role_customer ) )
|
assert_not(user1.roles.include?(role_customer))
|
||||||
#assert_not( user1.roles.include?( role_report ) )
|
#assert_not( user1.roles.include?( role_report ) )
|
||||||
|
|
||||||
group_dasa = Group.where( name: 'dasa' ).first
|
group_dasa = Group.where(name: 'dasa').first
|
||||||
group_raw = Group.where( name: 'Raw' ).first
|
group_raw = Group.where(name: 'Raw').first
|
||||||
|
|
||||||
assert_not( user1.groups_access('full').include?( group_dasa ) )
|
assert_not(user1.groups_access('full').include?(group_dasa))
|
||||||
assert( user1.groups_access('full').include?( group_raw ) )
|
assert(user1.groups_access('full').include?(group_raw))
|
||||||
|
|
||||||
user2 = User.find(3)
|
user2 = User.find(3)
|
||||||
assert_equal( 'agent-2 firstname äöüß', user2.firstname )
|
assert_equal('agent-2 firstname äöüß', user2.firstname)
|
||||||
assert_equal( 'agent-2 lastname äöüß', user2.lastname )
|
assert_equal('agent-2 lastname äöüß', user2.lastname)
|
||||||
assert_equal( 'agent-2', user2.login )
|
assert_equal('agent-2', user2.login)
|
||||||
assert_equal( 'agent-2@example.com', user2.email )
|
assert_equal('agent-2@example.com', user2.email)
|
||||||
assert_equal( true, user2.active )
|
assert_equal(true, user2.active)
|
||||||
|
|
||||||
assert( user2.roles.include?( role_agent ) )
|
assert(user2.roles.include?(role_agent))
|
||||||
assert( user2.roles.include?( role_admin ) )
|
assert(user2.roles.include?(role_admin))
|
||||||
assert_not( user2.roles.include?( role_customer ) )
|
assert_not(user2.roles.include?(role_customer))
|
||||||
#assert( user2.roles.include?( role_report ) )
|
#assert( user2.roles.include?( role_report ) )
|
||||||
|
|
||||||
assert( user2.groups_access('full').include?( group_dasa ) )
|
assert(user2.groups_access('full').include?(group_dasa))
|
||||||
assert( user2.groups_access('full').include?( group_raw ) )
|
assert(user2.groups_access('full').include?(group_raw))
|
||||||
|
|
||||||
user3 = User.find(7)
|
user3 = User.find(7)
|
||||||
assert_equal( 'invalid', user3.firstname )
|
assert_equal('invalid', user3.firstname)
|
||||||
assert_equal( 'invalid', user3.lastname )
|
assert_equal('invalid', user3.lastname)
|
||||||
assert_equal( 'invalid', user3.login )
|
assert_equal('invalid', user3.login)
|
||||||
assert_equal( 'invalid@example.com', user3.email )
|
assert_equal('invalid@example.com', user3.email)
|
||||||
assert_equal( false, user3.active )
|
assert_equal(false, user3.active)
|
||||||
|
|
||||||
assert( user3.roles.include?( role_agent ) )
|
assert(user3.roles.include?(role_agent))
|
||||||
assert_not( user3.roles.include?( role_admin ) )
|
assert_not(user3.roles.include?(role_admin))
|
||||||
assert_not( user3.roles.include?( role_customer ) )
|
assert_not(user3.roles.include?(role_customer))
|
||||||
#assert( user3.roles.include?( role_report ) )
|
#assert( user3.roles.include?( role_report ) )
|
||||||
|
|
||||||
assert_not( user3.groups_access('full').include?( group_dasa ) )
|
assert_not(user3.groups_access('full').include?(group_dasa))
|
||||||
assert_not( user3.groups_access('full').include?( group_raw ) )
|
assert_not(user3.groups_access('full').include?(group_raw))
|
||||||
|
|
||||||
user4 = User.find(8)
|
user4 = User.find(8)
|
||||||
assert_equal( 'invalid-temp', user4.firstname )
|
assert_equal('invalid-temp', user4.firstname)
|
||||||
assert_equal( 'invalid-temp', user4.lastname )
|
assert_equal('invalid-temp', user4.lastname)
|
||||||
assert_equal( 'invalid-temp', user4.login )
|
assert_equal('invalid-temp', user4.login)
|
||||||
assert_equal( 'invalid-temp@example.com', user4.email )
|
assert_equal('invalid-temp@example.com', user4.email)
|
||||||
assert_equal( false, user4.active )
|
assert_equal(false, user4.active)
|
||||||
|
|
||||||
assert( user4.roles.include?( role_agent ) )
|
assert(user4.roles.include?(role_agent))
|
||||||
assert_not( user4.roles.include?( role_admin ) )
|
assert_not(user4.roles.include?(role_admin))
|
||||||
assert_not( user4.roles.include?( role_customer ) )
|
assert_not(user4.roles.include?(role_customer))
|
||||||
#assert( user4.roles.include?( role_report ) )
|
#assert( user4.roles.include?( role_report ) )
|
||||||
|
|
||||||
assert_not( user4.groups_access('full').include?( group_dasa ) )
|
assert_not(user4.groups_access('full').include?(group_dasa))
|
||||||
assert_not( user4.groups_access('full').include?( group_raw ) )
|
assert_not(user4.groups_access('full').include?(group_raw))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# check all synced states and state types
|
# check all synced states and state types
|
||||||
test 'check ticket stats' do
|
test 'check ticket stats' do
|
||||||
state = Ticket::State.find(1)
|
state = Ticket::State.find(1)
|
||||||
assert_equal( 'new', state.name )
|
assert_equal('new', state.name)
|
||||||
assert_equal( 'new', state.state_type.name )
|
assert_equal('new', state.state_type.name)
|
||||||
|
|
||||||
state = Ticket::State.find(2)
|
state = Ticket::State.find(2)
|
||||||
assert_equal( 'closed successful', state.name )
|
assert_equal('closed successful', state.name)
|
||||||
assert_equal( 'closed', state.state_type.name )
|
assert_equal('closed', state.state_type.name)
|
||||||
|
|
||||||
state = Ticket::State.find(6)
|
state = Ticket::State.find(6)
|
||||||
assert_equal( 'pending reminder', state.name )
|
assert_equal('pending reminder', state.name)
|
||||||
assert_equal( 'pending reminder', state.state_type.name )
|
assert_equal('pending reminder', state.state_type.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# check groups/queues
|
# check groups/queues
|
||||||
test 'check groups' do
|
test 'check groups' do
|
||||||
group1 = Group.find(1)
|
group1 = Group.find(1)
|
||||||
assert_equal( 'Postmaster', group1.name )
|
assert_equal('Postmaster', group1.name)
|
||||||
assert_equal( true, group1.active )
|
assert_equal(true, group1.active)
|
||||||
|
|
||||||
group2 = Group.find(19)
|
group2 = Group.find(19)
|
||||||
assert_equal( 'UnitTestQueue20668', group2.name )
|
assert_equal('UnitTestQueue20668', group2.name)
|
||||||
assert_equal( false, group2.active )
|
assert_equal(false, group2.active)
|
||||||
end
|
end
|
||||||
|
|
||||||
# check imported customers and organization relation
|
# check imported customers and organization relation
|
||||||
test 'check customers / organizations' do
|
test 'check customers / organizations' do
|
||||||
user1 = User.where( login: 'jn' ).first
|
user1 = User.where(login: 'jn').first
|
||||||
assert_equal( 'Johannes', user1.firstname )
|
assert_equal('Johannes', user1.firstname)
|
||||||
assert_equal( 'Nickel', user1.lastname )
|
assert_equal('Nickel', user1.lastname)
|
||||||
assert_equal( 'jn', user1.login )
|
assert_equal('jn', user1.login)
|
||||||
assert_equal( 'jn@example.com', user1.email )
|
assert_equal('jn@example.com', user1.email)
|
||||||
organization1 = user1.organization
|
organization1 = user1.organization
|
||||||
assert_equal( 'Znuny GmbH Berlin', organization1.name )
|
assert_equal('Znuny GmbH Berlin', organization1.name)
|
||||||
assert_equal( 'äöüß', organization1.note )
|
assert_equal('äöüß', organization1.note)
|
||||||
|
|
||||||
user2 = User.where( login: 'test90133' ).first
|
user2 = User.where(login: 'test90133').first
|
||||||
assert_equal( 'test90133', user2.firstname )
|
assert_equal('test90133', user2.firstname)
|
||||||
assert_equal( 'test90133', user2.lastname )
|
assert_equal('test90133', user2.lastname)
|
||||||
assert_equal( 'test90133', user2.login )
|
assert_equal('test90133', user2.login)
|
||||||
assert_equal( 'qa4711@t-online.de', user2.email )
|
assert_equal('qa4711@t-online.de', user2.email)
|
||||||
organization2 = user2.organization
|
organization2 = user2.organization
|
||||||
assert( organization2, nil )
|
assert(organization2, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# check imported tickets
|
# check imported tickets
|
||||||
|
@ -173,57 +173,57 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# ticket is open
|
# ticket is open
|
||||||
ticket = Ticket.find(728)
|
ticket = Ticket.find(728)
|
||||||
assert_equal( 'test #1', ticket.title )
|
assert_equal('test #1', ticket.title)
|
||||||
assert_equal( 'open', ticket.state.name )
|
assert_equal('open', ticket.state.name)
|
||||||
assert_equal( 'Misc', ticket.group.name )
|
assert_equal('Misc', ticket.group.name)
|
||||||
assert_equal( '4 high', ticket.priority.name )
|
assert_equal('4 high', ticket.priority.name)
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal('agent-2', ticket.owner.login)
|
||||||
assert_equal( 'partner', ticket.customer.login )
|
assert_equal('partner', ticket.customer.login)
|
||||||
assert_equal( 'Partner der betreut', ticket.organization.name )
|
assert_equal('Partner der betreut', ticket.organization.name)
|
||||||
assert_equal( Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal(Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s)
|
||||||
assert_nil( ticket.close_at )
|
assert_nil(ticket.close_at)
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# - create entry
|
# - create entry
|
||||||
|
|
||||||
# ticket is created with state closed
|
# ticket is created with state closed
|
||||||
ticket = Ticket.find(729)
|
ticket = Ticket.find(729)
|
||||||
assert_equal( 'test #2', ticket.title )
|
assert_equal('test #2', ticket.title)
|
||||||
assert_equal( 'closed successful', ticket.state.name )
|
assert_equal('closed successful', ticket.state.name)
|
||||||
assert_equal( 'Raw', ticket.group.name )
|
assert_equal('Raw', ticket.group.name)
|
||||||
assert_equal( '3 normal', ticket.priority.name )
|
assert_equal('3 normal', ticket.priority.name)
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal('agent-2', ticket.owner.login)
|
||||||
assert_equal( 'jn2', ticket.customer.login )
|
assert_equal('jn2', ticket.customer.login)
|
||||||
assert_equal( 'Znuny GmbH', ticket.organization.name )
|
assert_equal('Znuny GmbH', ticket.organization.name)
|
||||||
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal(Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s)
|
||||||
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_at.to_s )
|
assert_equal(Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_at.to_s)
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# - create entry
|
# - create entry
|
||||||
|
|
||||||
# ticket is created open and now closed
|
# ticket is created open and now closed
|
||||||
ticket = Ticket.find(730)
|
ticket = Ticket.find(730)
|
||||||
assert_equal( 'test #3', ticket.title )
|
assert_equal('test #3', ticket.title)
|
||||||
assert_equal( 'closed successful', ticket.state.name )
|
assert_equal('closed successful', ticket.state.name)
|
||||||
assert_equal( 'Postmaster', ticket.group.name )
|
assert_equal('Postmaster', ticket.group.name)
|
||||||
assert_equal( '3 normal', ticket.priority.name )
|
assert_equal('3 normal', ticket.priority.name)
|
||||||
assert_equal( 'agent-2', ticket.owner.login )
|
assert_equal('agent-2', ticket.owner.login)
|
||||||
assert_equal( 'betreuterkunde2', ticket.customer.login )
|
assert_equal('betreuterkunde2', ticket.customer.login)
|
||||||
assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name )
|
assert_equal('Noch ein betreuter Kunde', ticket.organization.name)
|
||||||
assert_equal( Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s )
|
assert_equal(Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s)
|
||||||
assert_equal( Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_at.to_s )
|
assert_equal(Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_at.to_s)
|
||||||
|
|
||||||
# ticket dynamic fields
|
# ticket dynamic fields
|
||||||
ticket = Ticket.find(591)
|
ticket = Ticket.find(591)
|
||||||
assert_equal( 'Some other smart subject!', ticket.title )
|
assert_equal('Some other smart subject!', ticket.title)
|
||||||
assert_equal( '488', ticket.vertriebsweg )
|
assert_equal('488', ticket.vertriebsweg)
|
||||||
assert_equal( '["193"]', ticket.te_test ) # TODO: multiselect
|
assert_equal('["193"]', ticket.te_test) # TODO: multiselect
|
||||||
assert_equal( '358', ticket.sugar_crm_remote_no )
|
assert_equal('358', ticket.sugar_crm_remote_no)
|
||||||
assert_equal( '69', ticket.sugar_crm_company_selected_no )
|
assert_equal('69', ticket.sugar_crm_company_selected_no)
|
||||||
assert_equal( '["382"]', ticket.sugar_crm_company_selection ) # TODO: multiselect
|
assert_equal('["382"]', ticket.sugar_crm_company_selection) # TODO: multiselect
|
||||||
assert_equal( '310', ticket.topic_no )
|
assert_equal('310', ticket.topic_no)
|
||||||
assert_equal( '495', ticket.open_exchange_ticket_number )
|
assert_equal('495', ticket.open_exchange_ticket_number)
|
||||||
assert_equal( '208', ticket.hostname )
|
assert_equal('208', ticket.hostname)
|
||||||
|
|
||||||
# check history
|
# check history
|
||||||
# - create entry
|
# - create entry
|
||||||
|
@ -233,18 +233,18 @@ class OtrsImportTest < ActiveSupport::TestCase
|
||||||
test 'check article attachments' do
|
test 'check article attachments' do
|
||||||
|
|
||||||
article = Ticket::Article.find(149)
|
article = Ticket::Article.find(149)
|
||||||
assert_equal( 5, article.attachments.count )
|
assert_equal(5, article.attachments.count)
|
||||||
|
|
||||||
attachment = article.attachments.first
|
attachment = article.attachments.first
|
||||||
assert_equal( 'image/jpeg', attachment[:preferences]['Mime-Type'] )
|
assert_equal('image/jpeg', attachment[:preferences]['Mime-Type'])
|
||||||
assert_equal( 'Cursor_und_Banners_and_Alerts_und_Paket-Verwaltung_-_Admin_-_otrs336_und_otrs336.jpg', attachment.filename )
|
assert_equal('Cursor_und_Banners_and_Alerts_und_Paket-Verwaltung_-_Admin_-_otrs336_und_otrs336.jpg', attachment.filename)
|
||||||
|
|
||||||
article = Ticket::Article.find(156)
|
article = Ticket::Article.find(156)
|
||||||
assert_equal( 2, article.attachments.count )
|
assert_equal(2, article.attachments.count)
|
||||||
|
|
||||||
attachment = article.attachments.second
|
attachment = article.attachments.second
|
||||||
assert_equal( 'application/pdf; name="=?UTF-8?B?5ZSQ6K+X5LiJ55m+6aaWLnBkZg==?="', attachment[:preferences]['Mime-Type'] )
|
assert_equal('application/pdf; name="=?UTF-8?B?5ZSQ6K+X5LiJ55m+6aaWLnBkZg==?="', attachment[:preferences]['Mime-Type'])
|
||||||
assert_equal( '唐诗三百首.pdf', attachment.filename )
|
assert_equal('唐诗三百首.pdf', attachment.filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -366,12 +366,12 @@ class PackageTest < ActiveSupport::TestCase
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
if test[:zpm]
|
if test[:zpm]
|
||||||
File.delete(location )
|
File.delete(location)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if test[:verify] && test[:verify][:package]
|
if test[:verify] && test[:verify][:package]
|
||||||
exists = Package.where(name: test[:verify][:package][:name], version: test[:verify][:package][:version]).first
|
exists = Package.where(name: test[:verify][:package][:name], version: test[:verify][:package][:version]).first
|
||||||
assert(exists, "package '#{test[:verify][:package][:name]}' is not installed" )
|
assert(exists, "package '#{test[:verify][:package][:name]}' is not installed")
|
||||||
end
|
end
|
||||||
next if !test[:verify]
|
next if !test[:verify]
|
||||||
next if !test[:verify][:check_files]
|
next if !test[:verify][:check_files]
|
||||||
|
@ -379,9 +379,9 @@ class PackageTest < ActiveSupport::TestCase
|
||||||
test[:verify][:check_files].each do |item|
|
test[:verify][:check_files].each do |item|
|
||||||
exists = File.exist?(item[:location])
|
exists = File.exist?(item[:location])
|
||||||
if item[:result]
|
if item[:result]
|
||||||
assert(exists, "'#{item[:location]}' exists" )
|
assert(exists, "'#{item[:location]}' exists")
|
||||||
else
|
else
|
||||||
assert_not(exists, "'#{item[:location]}' doesn't exists" )
|
assert_not(exists, "'#{item[:location]}' doesn't exists")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class ModelTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
assert_raises( ActiveRecord::RecordNotUnique ) do
|
assert_raises(ActiveRecord::RecordNotUnique) do
|
||||||
Group.create_if_not_exists(
|
Group.create_if_not_exists(
|
||||||
name: 'model1-Create_If_Not_Exists',
|
name: 'model1-Create_If_Not_Exists',
|
||||||
active: true,
|
active: true,
|
||||||
|
@ -41,7 +41,7 @@ class ModelTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
assert_raises( ActiveRecord::RecordNotUnique ) do
|
assert_raises(ActiveRecord::RecordNotUnique) do
|
||||||
Group.create_or_update(
|
Group.create_or_update(
|
||||||
name: 'model1-Create_Or_Update',
|
name: 'model1-Create_Or_Update',
|
||||||
active: true,
|
active: true,
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ObjectCacheTest < ActiveSupport::TestCase
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
roles = Role.where( name: %w[Agent Admin] )
|
roles = Role.where(name: %w[Agent Admin])
|
||||||
groups = Group.all
|
groups = Group.all
|
||||||
user1 = User.create_or_update(
|
user1 = User.create_or_update(
|
||||||
login: 'object_cache1@example.org',
|
login: 'object_cache1@example.org',
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ObjectCreateUpdateWithRefNameTest < ActiveSupport::TestCase
|
||||||
assert(org3.member_ids.sort.include?(user2.id))
|
assert(org3.member_ids.sort.include?(user2.id))
|
||||||
assert_not_equal(org2.id, org3.id)
|
assert_not_equal(org2.id, org3.id)
|
||||||
|
|
||||||
assert_raises( ActiveRecord::AssociationTypeMismatch ) do
|
assert_raises(ActiveRecord::AssociationTypeMismatch) do
|
||||||
Organization.create_or_update_with_ref(
|
Organization.create_or_update_with_ref(
|
||||||
name: 'some org update_with_ref member2',
|
name: 'some org update_with_ref member2',
|
||||||
members: ['object_ref_name2@example.org'],
|
members: ['object_ref_name2@example.org'],
|
||||||
|
|
|
@ -344,7 +344,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
owner_id: User.lookup(login: '-').id,
|
owner_id: User.lookup(login: '-').id,
|
||||||
title: 'Unit Test 4 (äöüß)!',
|
title: 'Unit Test 4 (äöüß)!',
|
||||||
state_id: Ticket::State.lookup(name: 'new').id,
|
state_id: Ticket::State.lookup(name: 'new').id,
|
||||||
priority_id: Ticket::Priority.lookup( name: '2 normal').id,
|
priority_id: Ticket::Priority.lookup(name: '2 normal').id,
|
||||||
updated_by_id: @agent_user1.id,
|
updated_by_id: @agent_user1.id,
|
||||||
created_by_id: @agent_user1.id,
|
created_by_id: @agent_user1.id,
|
||||||
)
|
)
|
||||||
|
|
|
@ -114,7 +114,7 @@ class SessionBasicTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# get as stream
|
# get as stream
|
||||||
result1 = as_client1.push
|
result1 = as_client1.push
|
||||||
assert( result1, 'check as agent1 - recall 3')
|
assert(result1, 'check as agent1 - recall 3')
|
||||||
travel_back
|
travel_back
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1504,7 +1504,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase
|
||||||
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
||||||
assert_equal([], ticket1.tag_list)
|
assert_equal([], ticket1.tag_list)
|
||||||
|
|
||||||
ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') )
|
ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org'))
|
||||||
|
|
||||||
UserInfo.current_user_id = agent.id
|
UserInfo.current_user_id = agent.id
|
||||||
Ticket::Article.create!(
|
Ticket::Article.create!(
|
||||||
|
@ -1617,7 +1617,7 @@ class TicketTriggerRecursiveDisabledTest < ActiveSupport::TestCase
|
||||||
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
||||||
assert_equal([], ticket1.tag_list)
|
assert_equal([], ticket1.tag_list)
|
||||||
|
|
||||||
ticket1.update!(customer: customer )
|
ticket1.update!(customer: customer)
|
||||||
|
|
||||||
UserInfo.current_user_id = agent.id
|
UserInfo.current_user_id = agent.id
|
||||||
Ticket::Article.create!(
|
Ticket::Article.create!(
|
||||||
|
|
|
@ -1530,7 +1530,7 @@ class TicketTriggerTest < ActiveSupport::TestCase
|
||||||
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
|
||||||
assert_equal([], ticket1.tag_list)
|
assert_equal([], ticket1.tag_list)
|
||||||
|
|
||||||
ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org') )
|
ticket1.update!(customer: User.lookup(email: 'nicole.braun@zammad.org'))
|
||||||
|
|
||||||
UserInfo.current_user_id = agent.id
|
UserInfo.current_user_id = agent.id
|
||||||
Ticket::Article.create!(
|
Ticket::Article.create!(
|
||||||
|
|
Loading…
Reference in a new issue