2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2020-02-20 12:15:03 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Manage > Channels > Twitter', :use_vcr, type: :system do
|
|
|
|
|
|
|
|
context 'credentials' do
|
|
|
|
|
|
|
|
before { visit '/#channels/twitter' }
|
|
|
|
|
|
|
|
context 'incomplete' do
|
|
|
|
it 'displays a 401 error modal' do
|
|
|
|
within(:active_content) do
|
|
|
|
find('.js-configApp').click
|
|
|
|
|
|
|
|
modal_ready
|
|
|
|
fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
|
|
|
|
fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
|
|
|
|
click_on 'Submit'
|
|
|
|
|
2021-07-01 11:23:52 +00:00
|
|
|
expect(page).to have_css('.modal .alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
|
2020-02-20 12:15:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'invalid' do
|
|
|
|
it 'displays a 401 error modal' do
|
|
|
|
within(:active_content) do
|
|
|
|
find('.js-configApp').click
|
|
|
|
|
|
|
|
modal_ready
|
|
|
|
fill_in 'Twitter Consumer Key *', with: 'some_key', exact: true
|
|
|
|
fill_in 'Twitter Consumer Secret *', with: 'some_secret', exact: true
|
|
|
|
fill_in 'Twitter Access Token *', with: 'some_oauth_token', exact: true
|
|
|
|
fill_in 'Twitter Access Token Secret *', with: 'some_oauth_token_secret', exact: true
|
|
|
|
fill_in 'Twitter Dev environment label *', with: 'some_env', exact: true
|
|
|
|
click_on 'Submit'
|
|
|
|
|
2021-07-01 11:23:52 +00:00
|
|
|
expect(page).to have_css('.modal .alert', text: '401 Unauthorized (Invalid credentials may be to blame.)')
|
2020-02-20 12:15:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|