microsoft365_spec.rb 851 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Microsoft365 XOAUTH2', type: :integration, required_envs: %w[MICROSOFT365_REFRESH_TOKEN MICROSOFT365_CLIENT_ID MICROSOFT365_CLIENT_SECRET MICROSOFT365_USER] do # rubocop:disable RSpec/DescribeClass
  4. let(:channel) do
  5. create(:microsoft365_channel).tap(&:refresh_xoauth2!)
  6. end
  7. context 'when probing inbound' do
  8. it 'succeeds' do
  9. result = EmailHelper::Probe.inbound(channel.options[:inbound])
  10. expect(result[:result]).to eq('ok')
  11. end
  12. end
  13. context 'when probing outbound' do
  14. it 'succeeds' do
  15. result = EmailHelper::Probe.outbound(channel.options[:outbound], ENV['MICROSOFT365_USER'], "test microsoft365 oauth unittest #{Random.new_seed}")
  16. expect(result[:result]).to eq('ok')
  17. end
  18. end
  19. end