Skip to content

Commit

Permalink
Test drive configuring Threema at org creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwr18 committed Sep 9, 2024
1 parent 41a5533 commit 3553d74
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/dashboards/organization_dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class OrganizationDashboard < Administrate::BaseDashboard
whats_app_profile_about: Field::Text,
email_from_address: Field::Email,
telegram_bot_username: Field::Text,
telegram_bot_api_key: Field::Text
telegram_bot_api_key: Field::Text,
threemarb_api_identity: Field::Text,
threemarb_api_secret: Field::Password,
threemarb_private: Field::Password
}.freeze

COLLECTION_ATTRIBUTES = %i[
Expand All @@ -52,6 +55,7 @@ class OrganizationDashboard < Administrate::BaseDashboard
upgraded_business_plan_at
email_from_address
telegram_bot_username
threemarb_api_identity
].freeze

FORM_ATTRIBUTES_NEW = %i[
Expand All @@ -71,6 +75,9 @@ class OrganizationDashboard < Administrate::BaseDashboard
email_from_address
telegram_bot_username
telegram_bot_api_key
threemarb_api_identity
threemarb_api_secret
threemarb_private
].freeze

FORM_ATTRIBUTES_EDIT = %i[
Expand Down
19 changes: 19 additions & 0 deletions spec/requests/admin/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@
expect(organization.telegram_bot_api_key).to eq('valid_api_key')
end
end

context 'Threema' do
let(:params) do
required_params.deep_merge({ organization: { threemarb_api_identity: '*APIIDENT',
threemarb_api_secret: 'valid_secret',
threemarb_private: 'valid_private_key' } })
end

it 'allows configuring Threema' do
subject.call
follow_redirect!
expect(page).to have_content('*APIIDENT')
expect(page).not_to have_content('valid_secret')
expect(page).not_to have_content('valid_private_key')

organization = Organization.find_by(threemarb_api_identity: '*APIIDENT')
expect(organization).to have_attributes(threemarb_api_secret: 'valid_secret', threemarb_private: 'valid_private_key')
end
end
end
end
end

0 comments on commit 3553d74

Please sign in to comment.