Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
56d3c66c9e
76 changed files with 325 additions and 358 deletions
|
@ -184,6 +184,10 @@ Metrics/BlockNesting:
|
|||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
||||
Enabled: false
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Description: 'Avoid modules longer than 100 lines of code.'
|
||||
Enabled: false
|
||||
|
||||
# TODO
|
||||
|
||||
Style/Documentation:
|
||||
|
|
|
@ -25,7 +25,7 @@ class App.TicketZoom extends App.Controller
|
|||
@sidebarState = {}
|
||||
@ticketLastAttributes = {}
|
||||
|
||||
# if we are in init task startup, ognore overview_dd
|
||||
# if we are in init task startup, ignore overview_id
|
||||
if !params.init
|
||||
@overview_id = params.overview_id
|
||||
else
|
||||
|
|
|
@ -44,24 +44,24 @@ Example:
|
|||
{
|
||||
"item":"#otrs",
|
||||
"type": "mixed", # optional, possible 'mixed' (default), 'recent', 'popular'
|
||||
"group": "OTRS",
|
||||
"group_id:": 1,
|
||||
"limit": 1, # optional
|
||||
},
|
||||
{
|
||||
"item":"#zombie23",
|
||||
"group": "Zombie Apocalypse Early Warning System",
|
||||
"group_id:": 2,
|
||||
},
|
||||
{
|
||||
"item":"#otterhub",
|
||||
"group": "Community",
|
||||
"group_id:": 3,
|
||||
}
|
||||
],
|
||||
"mentions" {
|
||||
"group": "Twitter",
|
||||
"group_id:": 4,
|
||||
"limit": 100, # optional
|
||||
},
|
||||
"direct_messages": {
|
||||
"group": "Twitter",
|
||||
"group_id:": 4,
|
||||
"limit": 1, # optional
|
||||
}
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
message: e.to_s,
|
||||
subject: subject,
|
||||
}
|
||||
return # rubocop:disable Lint/NonLocalExitFromIterator
|
||||
return
|
||||
end
|
||||
|
||||
next if !found
|
||||
|
@ -735,7 +735,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
|
|||
render json: {
|
||||
result: 'ok',
|
||||
}
|
||||
return # rubocop:disable Lint/NonLocalExitFromIterator
|
||||
return
|
||||
}
|
||||
|
||||
# check delivery for 30 sek.
|
||||
|
|
|
@ -338,7 +338,6 @@ class UsersController < ApplicationController
|
|||
user_all = User.where('id != 1').order('created_at DESC').limit( params[:limit] || 20 )
|
||||
end
|
||||
|
||||
|
||||
# build result list
|
||||
if !params[:full]
|
||||
users = []
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module ApplicationHelper
|
||||
def inline_svg(path)
|
||||
File.open("public/assets/images/#{path}", "rb") do |file|
|
||||
File.open("public/assets/images/#{path}", 'rb') do |file|
|
||||
raw file.read
|
||||
end
|
||||
end
|
||||
|
|
|
@ -261,11 +261,9 @@ returns
|
|||
end
|
||||
|
||||
# delete login caches
|
||||
if self[:login]
|
||||
key = "#{self.class}::#{login}"
|
||||
Cache.delete(key)
|
||||
end
|
||||
return if !self[:login]
|
||||
|
||||
Cache.delete("#{self.class}::#{login}")
|
||||
end
|
||||
|
||||
def self.cache_set(data_id, data)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module ApplicationModel::ActivityStreamBase
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
#36 Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
module ApplicationModel::Assets
|
||||
|
||||
=begin
|
||||
|
@ -32,7 +31,7 @@ returns
|
|||
return data if !self['created_by_id'] && !self['updated_by_id']
|
||||
%w(created_by_id updated_by_id).each {|local_user_id|
|
||||
next if !self[ local_user_id ]
|
||||
next data[ User.to_app_model ] && data[ User.to_app_model ][ self[ local_user_id ] ]
|
||||
next if data[ User.to_app_model ] && data[ User.to_app_model ][ self[ local_user_id ] ]
|
||||
user = User.lookup( id: self[ local_user_id ] )
|
||||
data = user.assets( data )
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class ApplicationModel::BackgroundJobSearchIndex
|
||||
def initialize(object, o_id)
|
||||
@object = object
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module ApplicationModel::HistoryLogBase
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module ApplicationModel::SearchIndexBase
|
||||
|
||||
=begin
|
||||
|
|
|
@ -8,7 +8,7 @@ class Channel::Twitter
|
|||
@tweet = Tweet.new( @channel[:options][:auth] )
|
||||
@sync = @channel[:options][:sync]
|
||||
|
||||
Rails.logger.debug "twitter fetch started"
|
||||
Rails.logger.debug 'twitter fetch started'
|
||||
|
||||
fetch_search
|
||||
fetch_mentions
|
||||
|
@ -55,7 +55,7 @@ class Channel::Twitter
|
|||
break if search[:limit] && search[:limit] <= counter
|
||||
break if Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
|
||||
@tweet.to_group( tweet, search[:group] )
|
||||
@tweet.to_group( tweet, search[:group_id] )
|
||||
|
||||
counter += 1
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class Channel::Twitter
|
|||
break if @sync[:mentions][:limit] && @sync[:mentions][:limit] <= counter
|
||||
break if Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
|
||||
@tweet.to_group( tweet, @sync[:mentions][:group] )
|
||||
@tweet.to_group( tweet, @sync[:mentions][:group_id] )
|
||||
|
||||
counter += 1
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class Channel::Twitter
|
|||
break if @sync[:direct_messages][:limit] && @sync[:direct_messages][:limit] <= counter
|
||||
break if Ticket::Article.find_by( message_id: tweet.id.to_s )
|
||||
|
||||
@tweet.to_group( tweet, @sync[:direct_messages][:group] )
|
||||
@tweet.to_group( tweet, @sync[:direct_messages][:group_id] )
|
||||
|
||||
counter += 1
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ class Organization < ApplicationModel
|
|||
notify_clients_support
|
||||
latest_change_support
|
||||
|
||||
|
||||
private
|
||||
|
||||
def cache_delete
|
||||
|
|
|
@ -82,7 +82,6 @@ class Scheduler < ApplicationModel
|
|||
end
|
||||
|
||||
def self._start_job( job, try_count = 0, try_run_time = Time.zone.now )
|
||||
begin
|
||||
job.last_run = Time.zone.now
|
||||
job.pid = Thread.current.object_id
|
||||
job.save
|
||||
|
@ -114,7 +113,6 @@ class Scheduler < ApplicationModel
|
|||
raise "STOP thread for #{job.method} after #{try_count} tries"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.worker
|
||||
wait = 8
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
|
||||
class Store::Provider::File
|
||||
|
||||
# write file to fs
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::ActivityStreamLog
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class Ticket::Article < ApplicationModel
|
||||
load 'ticket/article/assets.rb'
|
||||
include Ticket::Article::Assets
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Article::ActivityStreamLog
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Assets
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class Ticket::Counter < ApplicationModel
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Escalation
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::HistoryLog
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Number::Date
|
||||
module_function
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Overviews
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Permission
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class Ticket::Priority < ApplicationModel
|
||||
self.table_name = 'ticket_priorities'
|
||||
validates :name, presence: true
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::ScreenOptions
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Search
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::SearchIndex
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class Ticket::State < ApplicationModel
|
||||
belongs_to :state_type, class_name: 'Ticket::StateType'
|
||||
validates :name, presence: true
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
class Ticket::StateType < ApplicationModel
|
||||
has_many :states, class_name: 'Ticket::State'
|
||||
validates :name, presence: true
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
module Ticket::Subject
|
||||
|
||||
=begin
|
||||
|
|
|
@ -27,9 +27,9 @@ returns
|
|||
dir = "#{Rails.root}/app/models/"
|
||||
Dir.glob( "#{dir}**/*.rb" ) do |entry|
|
||||
next if entry =~ /application_model/i
|
||||
next if entry =~ /channel\//i
|
||||
next if entry =~ /observer\//i
|
||||
next if entry =~ /store\/provider\//i
|
||||
next if entry =~ %r{channel/}i
|
||||
next if entry =~ %r{observer/}i
|
||||
next if entry =~ %r{store/provider/}i
|
||||
entry.gsub!(dir, '')
|
||||
entry = entry.to_classname
|
||||
model_class = load_adapter(entry)
|
||||
|
@ -81,37 +81,43 @@ returns
|
|||
list.each {|model_class, model_attributes|
|
||||
references[:model][model_class.to_s] = 0
|
||||
next if !model_attributes[:attributes]
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
if model_attributes[:attributes].include?(item)
|
||||
%w(created_by_id updated_by_id).each {|item|
|
||||
|
||||
next if !model_attributes[:attributes].include?(item)
|
||||
|
||||
count = model_class.where("#{item} = ?", object_id).count
|
||||
next if count == 0
|
||||
Rails.logger.debug "FOUND (by id) #{model_class}->#{item} #{count}!"
|
||||
references[:model][model_class.to_s] += count
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
# find relations via reflections
|
||||
list.each {|model_class, model_attributes|
|
||||
next if !model_attributes[:reflections]
|
||||
model_attributes[:reflections].each{|reflection_key, reflection_value|
|
||||
model_attributes[:reflections].each {|_reflection_key, reflection_value|
|
||||
|
||||
next if reflection_value.macro != :belongs_to
|
||||
|
||||
if reflection_value.options[:class_name] == object_name
|
||||
count = model_class.where("#{reflection_value.name}_id = ?", object_id).count
|
||||
next if count == 0
|
||||
Rails.logger.debug "FOUND (by ref without class) #{model_class}->#{reflection_value.name} #{count}!"
|
||||
references[:model][model_class.to_s] += count
|
||||
end
|
||||
if !reflection_value.options[:class_name] && reflection_value.name == object_name.downcase.to_sym
|
||||
|
||||
next if reflection_value.options[:class_name]
|
||||
next if reflection_value.name != object_name.downcase.to_sym
|
||||
|
||||
count = model_class.where("#{reflection_value.name}_id = ?", object_id).count
|
||||
next if count == 0
|
||||
|
||||
Rails.logger.debug "FOUND (by ref with class) #{model_class}->#{reflection_value.name} #{count}!"
|
||||
references[:model][model_class.to_s] += count
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
references[:model].each {|k, v|
|
||||
references[:model].each {|_k, v|
|
||||
next if v == 0
|
||||
references[:total] += v
|
||||
}
|
||||
|
|
25
lib/tweet.rb
25
lib/tweet.rb
|
@ -40,12 +40,11 @@ class Tweet
|
|||
|
||||
Rails.logger.error "Twitter (#{tweet.id}): unknown user source"
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
def to_user(tweet)
|
||||
|
||||
Rails.logger.debug "Create user from tweet..."
|
||||
Rails.logger.debug 'Create user from tweet...'
|
||||
Rails.logger.debug tweet.inspect
|
||||
|
||||
# do tweet_user lookup
|
||||
|
@ -90,12 +89,12 @@ class Tweet
|
|||
user
|
||||
end
|
||||
|
||||
def to_ticket(tweet, user, group)
|
||||
def to_ticket(tweet, user, group_id)
|
||||
|
||||
Rails.logger.debug "Create ticket from tweet..."
|
||||
Rails.logger.debug 'Create ticket from tweet...'
|
||||
Rails.logger.debug tweet.inspect
|
||||
Rails.logger.debug user.inspect
|
||||
Rails.logger.debug group.inspect
|
||||
Rails.logger.debug group_id.inspect
|
||||
|
||||
if tweet.class.to_s == 'Twitter::DirectMessage'
|
||||
ticket = Ticket.find_by(
|
||||
|
@ -112,7 +111,7 @@ class Tweet
|
|||
Ticket.create(
|
||||
customer_id: user.id,
|
||||
title: "#{tweet.text[0, 37]}...",
|
||||
group: Group.find_by( name: group ),
|
||||
group_id: group_id,
|
||||
state: Ticket::State.find_by( name: 'new' ),
|
||||
priority: Ticket::Priority.find_by( name: '2 normal' ),
|
||||
)
|
||||
|
@ -120,7 +119,7 @@ class Tweet
|
|||
|
||||
def to_article(tweet, user, ticket)
|
||||
|
||||
Rails.logger.debug "Create article from tweet..."
|
||||
Rails.logger.debug 'Create article from tweet...'
|
||||
Rails.logger.debug tweet.inspect
|
||||
Rails.logger.debug user.inspect
|
||||
Rails.logger.debug ticket.inspect
|
||||
|
@ -154,7 +153,7 @@ class Tweet
|
|||
)
|
||||
end
|
||||
|
||||
def to_group(tweet, group)
|
||||
def to_group(tweet, group_id)
|
||||
|
||||
Rails.logger.debug 'import tweet'
|
||||
|
||||
|
@ -178,10 +177,10 @@ class Tweet
|
|||
Rails.logger.debug 'import in_reply_tweet ' + tweet.in_reply_to_status_id.to_s
|
||||
|
||||
parent_tweet = @client.status( tweet.in_reply_to_status_id )
|
||||
ticket = to_group( parent_tweet, group )
|
||||
ticket = to_group( parent_tweet, group_id )
|
||||
end
|
||||
else
|
||||
ticket = to_ticket(tweet, user, group)
|
||||
ticket = to_ticket(tweet, user, group_id)
|
||||
end
|
||||
|
||||
to_article(tweet, user, ticket)
|
||||
|
@ -195,7 +194,6 @@ class Tweet
|
|||
|
||||
def from_article(article)
|
||||
|
||||
|
||||
tweet = nil
|
||||
if article[:type] == 'twitter direct-message'
|
||||
|
||||
|
@ -206,10 +204,9 @@ class Tweet
|
|||
article[:body],
|
||||
{}
|
||||
)
|
||||
|
||||
elsif article[:type] == 'twitter status'
|
||||
|
||||
Rails.logger.debug "Create tweet from article..."
|
||||
Rails.logger.debug 'Create tweet from article...'
|
||||
|
||||
tweet = @client.update(
|
||||
article[:body],
|
||||
|
@ -217,6 +214,8 @@ class Tweet
|
|||
in_reply_to_status_id: article[:in_reply_to]
|
||||
}
|
||||
)
|
||||
else
|
||||
fail "Can't handle unknown twitter article type 'article[:type]'."
|
||||
end
|
||||
|
||||
Rails.logger.debug tweet.inspect
|
||||
|
|
|
@ -26,12 +26,12 @@ class SwitchToUserTest < TestCase
|
|||
)
|
||||
|
||||
watch_for(
|
||||
:css => '.switchBackToUser',
|
||||
:value => 'zammad looks like',
|
||||
css: '.switchBackToUser',
|
||||
value: 'zammad looks like',
|
||||
)
|
||||
watch_for(
|
||||
:css => '.switchBackToUser',
|
||||
:value => 'Nicole',
|
||||
css: '.switchBackToUser',
|
||||
value: 'Nicole',
|
||||
)
|
||||
login = @browser.find_elements( { css: '.user-menu .user a' } )[0].attribute('title')
|
||||
assert_equal(login, 'nicole.braun@zammad.org')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ENV['RAILS_ENV'] = 'test'
|
||||
# rubocop:disable Next, CyclomaticComplexity, PerceivedComplexity, HandleExceptions, ClassVars, NonLocalExitFromIterator
|
||||
# rubocop:disable HandleExceptions, ClassVars, NonLocalExitFromIterator
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'selenium-webdriver'
|
||||
|
||||
|
@ -152,11 +152,11 @@ class TestCase < Test::Unit::TestCase
|
|||
(1..6).each {
|
||||
sleep 1
|
||||
login = instance.find_elements( { css: '#login' } )[0]
|
||||
if login
|
||||
|
||||
next if !login
|
||||
screenshot( browser: instance, comment: 'logout_ok' )
|
||||
assert( true, 'logout ok' )
|
||||
return
|
||||
end
|
||||
}
|
||||
screenshot( browser: instance, comment: 'logout_failed' )
|
||||
fail 'no login box found, seems logout was not successfully!'
|
||||
|
@ -578,7 +578,8 @@ class TestCase < Test::Unit::TestCase
|
|||
cookies.each {|cookie|
|
||||
#puts "CCC #{cookie.inspect}"
|
||||
# :name=>"_zammad_session_c25832f4de2", :value=>"adc31cd21615cb0a7ab269184ec8b76f", :path=>"/", :domain=>"localhost", :expires=>nil, :secure=>false}
|
||||
if cookie[:name] =~ /#{params[:name]}/i
|
||||
next if cookie[:name] !~ /#{params[:name]}/i
|
||||
|
||||
if params.key?( :value ) && cookie[:value].to_s =~ /#{params[:value]}/i
|
||||
assert( true, "matching value '#{params[:value]}' in cookie '#{cookie}'" )
|
||||
else
|
||||
|
@ -590,11 +591,9 @@ class TestCase < Test::Unit::TestCase
|
|||
fail "not matching expires '#{params[:expires]}' in cookie '#{cookie}'"
|
||||
end
|
||||
|
||||
if params[:should_not_exist]
|
||||
return if !params[:should_not_exist]
|
||||
|
||||
fail "cookie with name '#{params[:name]}' should not exist, but exists '#{cookies}'"
|
||||
end
|
||||
return
|
||||
end
|
||||
}
|
||||
if params[:should_not_exist]
|
||||
assert( true, "cookie with name '#{params[:name]}' is not existing" )
|
||||
|
@ -1226,7 +1225,9 @@ wait untill text in selector disabppears
|
|||
if data[:state] || data[:group] || data[:body]
|
||||
found = nil
|
||||
(1..10).each {
|
||||
if !found
|
||||
|
||||
next if found
|
||||
|
||||
begin
|
||||
text = instance.find_elements( { css: '.content.active .js-reset' } )[0].text
|
||||
if text =~ /(Discard your unsaved changes.|Verwerfen der)/
|
||||
|
@ -1236,7 +1237,6 @@ wait untill text in selector disabppears
|
|||
# try again
|
||||
end
|
||||
sleep 1
|
||||
end
|
||||
}
|
||||
if !found
|
||||
screenshot( browser: instance, comment: 'ticket_update_discard_message_failed' )
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable UselessAssignment
|
||||
require 'integration_test_helper'
|
||||
|
||||
class ElasticsearchTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable UselessAssignment
|
||||
require 'integration_test_helper'
|
||||
|
||||
class TwitterTest < ActiveSupport::TestCase
|
||||
|
@ -45,18 +44,18 @@ class TwitterTest < ActiveSupport::TestCase
|
|||
search: [
|
||||
{
|
||||
term: '#citheo42',
|
||||
group: 'Twitter',
|
||||
group_id: 2,
|
||||
},
|
||||
{
|
||||
term: '#citheo24',
|
||||
group: 'Users',
|
||||
group_id: 1,
|
||||
},
|
||||
],
|
||||
mentions: {
|
||||
group: 'Twitter',
|
||||
group_id: 2,
|
||||
},
|
||||
direct_messages: {
|
||||
group: 'Twitter',
|
||||
group_id: 2,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -73,7 +72,7 @@ class TwitterTest < ActiveSupport::TestCase
|
|||
ticket = Ticket.create(
|
||||
title: text[0, 40],
|
||||
customer_id: user.id,
|
||||
group: Group.find_by( name: 'Twitter' ),
|
||||
group_id: 2,
|
||||
state: Ticket::State.find_by( name: 'new' ),
|
||||
priority: Ticket::Priority.find_by( name: '2 normal' ),
|
||||
updated_by_id: 1,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
ENV['RAILS_ENV'] = 'test'
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
require 'cache'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
ENV['RAILS_ENV'] = 'test'
|
||||
# rubocop:disable ClassAndModuleChildren
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
require 'rails/test_help'
|
||||
require 'cache'
|
||||
|
|
|
@ -86,7 +86,7 @@ class AssetsTest < ActiveSupport::TestCase
|
|||
# touch org, check if user1 has changed
|
||||
sleep 2
|
||||
org2 = Organization.find(org.id)
|
||||
org2.note = "some note...#{rand(9999999999999)}"
|
||||
org2.note = "some note...#{rand(9_999_999_999_999)}"
|
||||
org2.save
|
||||
|
||||
attributes = org2.attributes_with_associations
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable PerceivedComplexity, CyclomaticComplexity
|
||||
require 'test_helper'
|
||||
|
||||
class HistoryTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -6,7 +6,7 @@ class ModelTest < ActiveSupport::TestCase
|
|||
|
||||
# create base
|
||||
groups = Group.where( name: 'Users' )
|
||||
roles = Role.where( name: ['Agent', 'Admin'] )
|
||||
roles = Role.where( name: %w(Agent Admin) )
|
||||
agent1 = User.create_or_update(
|
||||
login: 'model-agent1@example.com',
|
||||
firstname: 'Model',
|
||||
|
|
|
@ -54,7 +54,7 @@ class ObjectCacheTest < ActiveSupport::TestCase
|
|||
|
||||
# update group
|
||||
group1 = groups.first
|
||||
group1.note = "some note #{rand(9999999999)}"
|
||||
group1.note = "some note #{rand(9_999_999_999)}"
|
||||
group1.save
|
||||
|
||||
assets = user1.assets({})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable Next, UselessAssignment, BlockNesting
|
||||
require 'test_helper'
|
||||
|
||||
class OnlineNotificationTest < ActiveSupport::TestCase
|
||||
|
@ -283,7 +282,8 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
|||
notification_check( OnlineNotification.list(agent_user2, 10), test[:check] )
|
||||
|
||||
# check online notifications
|
||||
if test[:update][:online_notification]
|
||||
next if !test[:update][:online_notification]
|
||||
|
||||
if test[:update][:online_notification][:seen_only_exists]
|
||||
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
|
||||
assert( notification_seen_only_exists_exists( notifications ), 'not seen notifications for ticket available')
|
||||
|
@ -291,7 +291,6 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
|||
notifications = OnlineNotification.list_by_object( 'Ticket', ticket.id )
|
||||
assert( !notification_seen_only_exists_exists( notifications ), 'seen notifications for ticket available')
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
# merge tickets - also remove notifications of merged tickets
|
||||
|
@ -322,27 +321,27 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def notification_check( onine_notifications, checks )
|
||||
def notification_check( online_notifications, checks )
|
||||
checks.each { |check_item|
|
||||
hit = false
|
||||
onine_notifications.each {|onine_notification|
|
||||
if onine_notification['o_id'] == check_item[:o_id]
|
||||
if onine_notification['object'] == check_item[:object]
|
||||
if onine_notification['type'] == check_item[:type]
|
||||
if onine_notification['created_by_id'] == check_item[:created_by_id]
|
||||
online_notifications.each {|onine_notification|
|
||||
|
||||
next if onine_notification['o_id'] != check_item[:o_id]
|
||||
next if onine_notification['object'] != check_item[:object]
|
||||
next if onine_notification['type'] != check_item[:type]
|
||||
next if onine_notification['created_by_id'] != check_item[:created_by_id]
|
||||
|
||||
hit = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
break
|
||||
}
|
||||
#puts "--- #{onine_notifications.inspect}"
|
||||
#puts "--- #{online_notifications.inspect}"
|
||||
assert( hit, "online notification exists not #{check_item.inspect}" )
|
||||
}
|
||||
end
|
||||
|
||||
def notification_seen_only_exists_exists( onine_notifications )
|
||||
onine_notifications.each {|onine_notification|
|
||||
def notification_seen_only_exists_exists( online_notifications )
|
||||
online_notifications.each {|onine_notification|
|
||||
return false if !onine_notification['seen']
|
||||
}
|
||||
true
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable Next, UselessAssignment
|
||||
require 'test_helper'
|
||||
|
||||
class PackageTest < ActiveSupport::TestCase
|
||||
|
@ -281,7 +280,9 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k</file>
|
|||
exists = Package.where( name: test[:verify][:package][:name], version: test[:verify][:package][:version] ).first
|
||||
assert( exists, "package '#{test[:verify][:package][:name]}' is not installed" )
|
||||
end
|
||||
if test[:verify] && test[:verify][:check_files]
|
||||
next if !test[:verify]
|
||||
next if !test[:verify][:check_files]
|
||||
|
||||
test[:verify][:check_files].each {|item|
|
||||
exists = File.exist?( item[:location] )
|
||||
if item[:result]
|
||||
|
@ -290,7 +291,6 @@ X3RhYmxlIDpzYW1wbGVfdGFibGVzDQogIGVuZA0KZW5k</file>
|
|||
assert( !exists, "'#{item[:location]}' doesn't exists" )
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable UselessAssignment
|
||||
require 'test_helper'
|
||||
|
||||
class RestTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable UselessAssignment
|
||||
require 'test_helper'
|
||||
|
||||
class SessionBasicTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable UselessAssignment
|
||||
require 'test_helper'
|
||||
|
||||
class SessionBasicTicketTest < ActiveSupport::TestCase
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable Next, CyclomaticComplexity
|
||||
require 'test_helper'
|
||||
|
||||
class SessionCollectionsTest < ActiveSupport::TestCase
|
||||
|
@ -139,7 +138,8 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
|||
def check_if_collection_exists(results, collection, attributes = nil)
|
||||
results.each {|result|
|
||||
next if !result
|
||||
if result[:collection] && result[:collection][collection]
|
||||
next if !result[:collection]
|
||||
next if !result[:collection][collection]
|
||||
|
||||
# check just if collection exists
|
||||
return true if !attributes
|
||||
|
@ -154,7 +154,6 @@ class SessionCollectionsTest < ActiveSupport::TestCase
|
|||
}
|
||||
return true if match_all
|
||||
}
|
||||
end
|
||||
}
|
||||
nil
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# encoding: utf-8
|
||||
# rubocop:disable Next, UselessAssignment
|
||||
require 'test_helper'
|
||||
|
||||
class SessionEnhancedTest < ActiveSupport::TestCase
|
||||
|
@ -297,15 +296,14 @@ class SessionEnhancedTest < ActiveSupport::TestCase
|
|||
messages.each {|message|
|
||||
#puts ""
|
||||
#puts "message: #{message.inspect}"
|
||||
if message['event'] == 'resetCollection'
|
||||
next if message['event'] != 'resetCollection'
|
||||
#puts "rc: "
|
||||
if message['data']
|
||||
next if !message['data']
|
||||
|
||||
message['data'].each {|key, _value|
|
||||
#puts "rc: #{key}"
|
||||
collections_result[key] = true
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
#puts "c: #{collections_result.inspect}"
|
||||
collections_orig.each {|key, _value|
|
||||
|
|
Loading…
Reference in a new issue