MAJOR=8
MINOR=16
DEVNAME=sdb
DEVTYPE=disk
DISKSEQ=3
 ñ                     P      /usr/lib/debug/.dwz/x86_64-linux-gnu/apparmor.debug Ø@ ÁyãlÅË�r—‹Ñ7µÙ773896804a6236b0f1c6c307a071ecd4f64aa6.debug    4ê  .shstrtab .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt.got .text .fini .rodata .eh_frame_hdr .eh_frame .init_array .fini_array .dynamic .data .bss .gnu_debugaltlink .gnu_debuglink                                                                                                                                        8      8                                     &             X      X      $                              9             |      |                                     G   öÿÿo                     $                             Q             È      È      À                          Y             ˆ      ˆ      Ü                             a   ÿÿÿo       d	      d	      P                            n   þÿÿo       ¸	      ¸	      `                            }             
      
      8                           ‡      B       P      P      ¸                          ‘                                                         Œ                           à                            —                                                                                  <                             ¦             L#      L#      	                              ¬              0       0      t                             ´             t4      t4      „                              Â             ø4      ø4      Ü                             Ì             °L      °<                                   Ø             ¸L      ¸<                                   ä             ÀL      À<      ð                           ›             °N      °>      P                            í              P       @                                    ó             P      @      (                              ø                      @      H                              
                     X@      4                                                    Œ@                                        ˆ¾�þB gÁä€hÏÂƒh¹ÁÀ¿  D   	ˆl–ß=¿Jå2ÛR‚ œPA¸&n41hß�þe+8ÛOHA´ã²OçÃƒh gÂ_�uÐb&=LyZËcõÂÁ  5   ˆl–Ãa¾”ªi?u8 ¸ÛW ê˜´o�þ^”‹8àYŽ02Ó n?çÅƒ ÄÃÂ      MAJOR=8
MINOR=3
DEVNAME=sda3
DEVTYPE=partition
DISKSEQ=2
PARTN=3
PARTNAME=primary
 £    	# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

require 'rails_helper'

require 'requests/channel_admin/base_examples'

RSpec.describe 'WhatsApp channel admin API endpoints', aggregate_failures: true, authenticated_as: :user, type: :request do
  let(:user) { create(:admin) }

  it_behaves_like 'base channel management', factory: :whatsapp_channel, path: :whatsapp

  describe 'POST /api/v1/channels_admin/whatsapp' do
    it 'creates a channel' do
      params = attributes_for(:whatsapp_channel)[:options]

      allow(Service::Channel::Whatsapp::Create).to receive(:execute).and_return(create(:whatsapp_channel))

      post '/api/v1/channels/admin/whatsapp', params: params

      expect(response).to have_http_status(:ok)
      expect(Service::Channel::Whatsapp::Create).to have_received(:execute)
    end
  end

  describe 'PUT /api/v1/channels_admin/whatsapp/ID' do
    let(:channel) { create(:whatsapp_channel) }

    it 'updates a channel' do
      params = attributes_for(:whatsapp_channel)[:options]

      allow(Service::Channel::Whatsapp::Update).to receive(:execute).and_return(channel)

      put "/api/v1/channels/admin/whatsapp/#{channel.id}", params: params

      expect(response).to have_http_status(:ok)
      expect(Service::Channel::Whatsapp::Update).to have_received(:execute)
      expect(json_response).to include(
        'options' => include(
          'access_token' => SensitiveParamsHelper::SENSITIVE_MASK
 