0x0
  5   Áˆl–ßi~”Êi?u2 ]¸Ë÷Ú˜´o�þDÓË8Ù|­Æ(Ü ?Ÿß584ÞÁÜ H    Á<?xml version="1.0"?>
<oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oor="http://openoffice.org/2001/registry">
  <dependency file="main"/>
  <oor:component-data xmlns:install="http://openoffice.org/2004/installation" oor:name="Scripting" oor:package="org.openoffice.Office">
    <node oor:name="ScriptRuntimes">
      <node oor:name="Python" oor:op="replace">
        <prop oor:name="SupportedFileExtensions">
          <value>py</value>
        </prop>
      </node>
    </node>
  </oor:component-data>
</oor:data>
  E   Ãˆl–Ðz¾”ªC]Šq@=q¦®41hß�þDäm¬ã`rA D|.9üÿàƒ}ð?ß_�uÐb&=LyZËcõÃÞ &µ    Ã# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

require 'rails_helper'

# Test a full OTRS import process against a system with known state and compare some expected results.

RSpec.describe 'OTRS import', integration: true, integration_standalone: true, required_envs: %w[IMPORT_OTRS_ENDPOINT IMPORT_OTRS_ENDPOINT_KEY] do # rubocop:disable RSpec/DescribeClass

  before :all do # rubocop:disable RSpec/BeforeAfterAll
    Setting.set('import_otrs_endpoint', ENV['IMPORT_OTRS_ENDPOINT'])
    Setting.set('import_otrs_endpoint_key', ENV['IMPORT_OTRS_ENDPOINT_KEY'])
    Setting.set('import_mode', true)
    Setting.set('system_init_done', false)

    WebMock.disable!
    Import::OTRS.start
    WebMock.enable!
  end

  context 'when importing setting' do
    let(:protocol) { ENV['IMPORT_OTRS_ENDPOINT'].start_with?('https') ? 'https' : 'http' }

    it 'imports correctly' do
      expect(Setting.get('system_id')).to be_truthy
      expect(Setting.get('http_type')).to eq(protocol)
      expect(Setting.get('organization')).to eq('Example Company')
    end
  end

  context 'when importing dynamic fields' do
    let(:local_objects) { ObjectManager::Attribute.list_full }
    let(:object_attribute_names) do
      local_objects.select do |local_object|
        local_object[:object] == 'Ticket'
      end.pluck('name')
    end
    let(:expected_object_attribute_names) { %w[vertriebsweg te_test number sugar_crm_remote_no sugar_crm_company_selected_no sugar_crm_company_selection combine title itsm_criticality customer_id itsm_impact itsm_review_required itsm_decision_result organization_id itsm_repair_start_time itsm_recovery_start_time itsm_decision_date itsm_due_date topic_no open_exchange_ticket_number hostname ticket_free_key11 type ticket_free_text11 open_exchange_tn topic zarafa_tn group_id scom_hostname checkbox_example scom_uuid scom_state scom_service location owner_id department customer_location textfeld state_id pending_time priority_id tags] }

    it 'imports correctly' do
      expect(object_attribute_names).to eq(expected_object_attribute_names)
    end
  end

  context 'when importing in general' do
    it 'imports the right number of objects' do
      expect(Ticket.count).to eq(603)
      expect(Ticket::Article.count).to eq(3182)
      expect(Store.count).to eq(274)
      expect(Ticket::State.count).to eq(9)
      expect(Group.count).to eq(24)
    end
  end

  context 'when importing users' do
    let(:role_admin)     { Role.where(name: 'Admin').first }
    let(:role_agent)     { Role.where(name: 'Agent').first }
    let(:role_customer)  { Role.where(name: 'Customer').first }
    let(:user1)          { User.find(2) }
    let(:user2)          { User.find(3) }
    let(:user3)          { User.find(7) }
    let(:user4)          { User.find(8) }
    let(:group_dasa)     { Group.where(name: 'dasa').first }
    let(:group_raw)      { Group.where(name: 'Raw').first }

    it 'imports correctly' do

      expect(user1).to have_attributes(
        {
          firstname: 'agent-1 firstname',
          lastname:  'agent-1 lastname',
          login:     'agent-1',
          email:     'agent-1@example.com',
          active:    true,
        }
      )

      expect(user1.roles).to include(role_agent).and(not_include(role_admin, role_customer))
      expect(user1.groups_access('