import_kayako_spec.rb 823 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'ImportKayako', authenticated_as: false, required_envs: %w[IMPORT_KAYAKO_ENDPOINT_SUBDOMAIN], set_up: false, type: :request do
  4. let(:action) { nil }
  5. let(:endpoint) { "/api/v1/import/kayako/#{action}" }
  6. describe 'POST /api/v1/import/kayako/url_check', :use_vcr do
  7. let(:action) { 'url_check' }
  8. it 'check invalid subdomain' do
  9. post endpoint, params: { url: 'https://reallybadexample.kayako.com' }, as: :json
  10. expect(json_response['result']).to eq('invalid')
  11. end
  12. it 'check valid subdomain' do
  13. post endpoint, params: { url: "https://#{ENV['IMPORT_KAYAKO_ENDPOINT_SUBDOMAIN']}.kayako.com" }, as: :json
  14. expect(json_response['result']).to eq('ok')
  15. end
  16. end
  17. end