2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2020-05-28 13:28:07 +00:00
|
|
|
require 'rails_helper'
|
2021-06-18 13:06:22 +00:00
|
|
|
RSpec.describe 'Gmail XOAUTH2', type: :integration, required_envs: %w[GMAIL_REFRESH_TOKEN GMAIL_CLIENT_ID GMAIL_CLIENT_SECRET GMAIL_USER] do # rubocop:disable RSpec/DescribeClass
|
2020-11-20 10:54:09 +00:00
|
|
|
let(:channel) do
|
|
|
|
create(:google_channel).tap(&:refresh_xoauth2!)
|
|
|
|
end
|
2020-05-28 13:28:07 +00:00
|
|
|
|
2020-11-23 13:13:16 +00:00
|
|
|
context 'when probing inbound' do
|
2020-05-28 13:28:07 +00:00
|
|
|
it 'succeeds' do
|
|
|
|
result = EmailHelper::Probe.inbound(channel.options[:inbound])
|
|
|
|
expect(result[:result]).to eq('ok')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-23 13:13:16 +00:00
|
|
|
context 'when probing outbound' do
|
2020-05-28 13:28:07 +00:00
|
|
|
it 'succeeds' do
|
|
|
|
result = EmailHelper::Probe.outbound(channel.options[:outbound], ENV['GMAIL_USER'], "test gmail oauth unittest #{Random.new_seed}")
|
|
|
|
expect(result[:result]).to eq('ok')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|