slack-ruby-client 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/integration_test.yml +45 -0
- data/.github/workflows/lint.yml +14 -0
- data/.github/workflows/pr_lint.yml +21 -0
- data/.github/workflows/test.yml +37 -0
- data/.gitignore +4 -3
- data/.rubocop.yml +6 -1
- data/.rubocop_todo.yml +88 -34
- data/.ruby-version +1 -0
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +6 -5
- data/Gemfile +13 -1
- data/Gemfile.danger +6 -0
- data/README.md +78 -76
- data/RELEASING.md +2 -2
- data/SECURITY.md +9 -0
- data/UPGRADING.md +28 -0
- data/bin/commands/admin_analytics.rb +16 -10
- data/bin/commands/admin_apps.rb +48 -42
- data/bin/commands/admin_apps_approved.rb +17 -11
- data/bin/commands/admin_apps_requests.rb +28 -11
- data/bin/commands/admin_apps_restricted.rb +17 -11
- data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
- data/bin/commands/admin_auth_policy.rb +37 -31
- data/bin/commands/admin_barriers.rb +44 -38
- data/bin/commands/admin_conversations.rb +221 -163
- data/bin/commands/admin_conversations_ekm.rb +17 -11
- data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
- data/bin/commands/admin_emoji.rb +50 -44
- data/bin/commands/admin_inviteRequests.rb +34 -28
- data/bin/commands/admin_inviteRequests_approved.rb +16 -10
- data/bin/commands/admin_inviteRequests_denied.rb +16 -10
- data/bin/commands/admin_roles.rb +46 -0
- data/bin/commands/admin_teams.rb +26 -20
- data/bin/commands/admin_teams_admins.rb +16 -10
- data/bin/commands/admin_teams_owners.rb +16 -10
- data/bin/commands/admin_teams_settings.rb +59 -53
- data/bin/commands/admin_usergroups.rb +45 -39
- data/bin/commands/admin_users.rb +91 -85
- data/bin/commands/admin_users_session.rb +72 -66
- data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
- data/bin/commands/api.rb +14 -8
- data/bin/commands/apps.rb +15 -9
- data/bin/commands/apps_connections.rb +13 -7
- data/bin/commands/apps_event_authorizations.rb +16 -10
- data/bin/commands/apps_manifest.rb +48 -41
- data/bin/commands/auth.rb +21 -15
- data/bin/commands/auth_teams.rb +16 -10
- data/bin/commands/bookmarks.rb +59 -0
- data/bin/commands/bots.rb +15 -9
- data/bin/commands/calls.rb +49 -43
- data/bin/commands/calls_participants.rb +24 -18
- data/bin/commands/chat.rb +150 -141
- data/bin/commands/chat_scheduledMessages.rb +19 -13
- data/bin/commands/conversations.rb +233 -225
- data/bin/commands/dialog.rb +15 -9
- data/bin/commands/dnd.rb +46 -40
- data/bin/commands/emoji.rb +14 -7
- data/bin/commands/files.rb +112 -83
- data/bin/commands/files_comments.rb +15 -9
- data/bin/commands/files_remote.rb +73 -67
- data/bin/commands/functions_workflows_steps.rb +22 -0
- data/bin/commands/functions_workflows_steps_responses.rb +22 -0
- data/bin/commands/migration.rb +16 -10
- data/bin/commands/oauth.rb +18 -12
- data/bin/commands/oauth_v2.rb +28 -22
- data/bin/commands/openid_connect.rb +26 -20
- data/bin/commands/pins.rb +33 -26
- data/bin/commands/reactions.rb +52 -46
- data/bin/commands/reminders.rb +53 -47
- data/bin/commands/rtm.rb +15 -24
- data/bin/commands/search.rb +43 -37
- data/bin/commands/stars.rb +38 -32
- data/bin/commands/team.rb +47 -38
- data/bin/commands/team_billing.rb +13 -7
- data/bin/commands/team_preferences.rb +13 -7
- data/bin/commands/team_profile.rb +14 -8
- data/bin/commands/tooling_tokens.rb +14 -8
- data/bin/commands/usergroups.rb +64 -58
- data/bin/commands/usergroups_users.rb +27 -21
- data/bin/commands/users.rb +111 -105
- data/bin/commands/users_admin.rb +28 -22
- data/bin/commands/users_prefs.rb +13 -7
- data/bin/commands/users_profile.rb +26 -20
- data/bin/commands/views.rb +47 -39
- data/bin/commands/workflows.rb +36 -30
- data/bin/slack +48 -43
- data/lib/slack/real_time/api/message.rb +3 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
- data/lib/slack/real_time/api/typing.rb +2 -1
- data/lib/slack/real_time/client.rb +10 -28
- data/lib/slack/real_time/config.rb +3 -3
- data/lib/slack/real_time/models/channel.rb +4 -0
- data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
- data/lib/slack/real_time/models.rb +2 -1
- data/lib/slack/real_time/stores/base.rb +25 -9
- data/lib/slack/real_time/stores/starter.rb +323 -309
- data/lib/slack/real_time/stores/store.rb +265 -198
- data/lib/slack/real_time/stores.rb +1 -7
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
- data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
- data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
- data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/calls.rb +5 -5
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +37 -31
- data/lib/slack/web/api/endpoints/conversations.rb +38 -34
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +1 -1
- data/lib/slack/web/api/endpoints/emoji.rb +2 -0
- data/lib/slack/web/api/endpoints/files.rb +45 -10
- data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
- data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
- data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
- data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +5 -3
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +0 -23
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +13 -1
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
- data/lib/slack/web/api/endpoints/users.rb +4 -4
- data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
- data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/views.rb +16 -11
- data/lib/slack/web/api/endpoints/workflows.rb +4 -4
- data/lib/slack/web/api/endpoints.rb +12 -0
- data/lib/slack/web/api/errors.rb +146 -8
- data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +2 -1
- data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
- data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
- data/lib/slack/web/api/patches/views.view-json.patch +55 -0
- data/lib/slack/web/api/templates/command.erb +18 -12
- data/lib/slack/web/api/templates/method.erb +1 -1
- data/lib/slack/web/config.rb +2 -2
- data/lib/slack/web/faraday/connection.rb +4 -4
- data/lib/slack/web/faraday/request.rb +2 -0
- data/lib/slack/web/faraday/response/raise_error.rb +2 -10
- data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
- data/lib/slack-ruby-client.rb +2 -1
- data/lib/tasks/real_time.rake +44 -24
- data/lib/tasks/web.rake +9 -8
- data/slack-ruby-client.gemspec +5 -14
- data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/slack/events/config_spec.rb +2 -0
- data/spec/slack/events/request_spec.rb +5 -1
- data/spec/slack/messages/formatting_spec.rb +10 -0
- data/spec/slack/real_time/api/message_spec.rb +1 -1
- data/spec/slack/real_time/api/ping_spec.rb +1 -1
- data/spec/slack/real_time/api/typing_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +91 -127
- data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
- data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
- data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
- data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
- data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
- data/spec/slack/real_time/stores/store_spec.rb +50 -0
- data/spec/slack/slack_spec.rb +5 -4
- data/spec/slack/version_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
- data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
- data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
- data/spec/slack/web/api/mixins/users_spec.rb +2 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
- data/spec/slack/web/client_spec.rb +39 -11
- data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
- data/spec/support/real_time/connected_client.rb +1 -1
- data/spec/support/real_time/loaded_client.rb +120 -0
- metadata +45 -197
- data/.travis.yml +0 -29
- data/bin/commands/admin_conversations_whitelist.rb +0 -37
- data/bin/commands/apps_permissions.rb +0 -23
- data/bin/commands/apps_permissions_resources.rb +0 -15
- data/bin/commands/apps_permissions_scopes.rb +0 -13
- data/bin/commands/apps_permissions_users.rb +0 -26
- data/bin/commands/channels.rb +0 -23
- data/bin/commands/groups.rb +0 -14
- data/bin/commands/im.rb +0 -6
- data/bin/commands/mpim.rb +0 -6
- data/bin/commands.rb +0 -66
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
- data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
- data/lib/slack/web/api/endpoints/channels.rb +0 -25
- data/lib/slack/web/api/endpoints/groups.rb +0 -13
- data/lib/slack/web/api/endpoints/im.rb +0 -13
- data/lib/slack/web/api/endpoints/mpim.rb +0 -13
- data/lib/slack/web/api/endpoints/presence.rb +0 -23
- data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
- data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
- data/lib/slack/web/api/templates/commands.erb +0 -6
- data/spec/fixtures/slack/web/rtm_start.yml +0 -815
- data/spec/slack/real_time/rtm_start_spec.rb +0 -14
- data/spec/slack/real_time/store_spec.rb +0 -12
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/
|
|
4
|
+
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_connect' } do
|
|
5
5
|
include_context 'connected client'
|
|
6
6
|
|
|
7
7
|
context 'im' do
|
|
8
|
-
it 'sets im data' do
|
|
9
|
-
expect(client.ims.count).to eq 10
|
|
10
|
-
end
|
|
11
8
|
it 'im_created' do
|
|
12
|
-
expect(client.ims['CDEADBEEF']).to
|
|
9
|
+
expect(client.ims['CDEADBEEF']).to be_nil
|
|
13
10
|
event = Slack::RealTime::Event.new(
|
|
14
11
|
'type' => 'im_created',
|
|
15
12
|
'channel' => {
|
|
@@ -19,30 +16,36 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
19
16
|
)
|
|
20
17
|
client.send(:dispatch, event)
|
|
21
18
|
im = client.ims['CDEADBEEF']
|
|
22
|
-
expect(im).not_to be nil
|
|
23
|
-
expect(im.name).to eq 'beef'
|
|
24
|
-
end
|
|
25
|
-
it 'im_open' do
|
|
26
|
-
im = client.ims['D0J1H6QTV']
|
|
27
19
|
expect(im).not_to be_nil
|
|
28
|
-
im.
|
|
29
|
-
event = Slack::RealTime::Event.new(
|
|
30
|
-
'type' => 'im_open',
|
|
31
|
-
'channel' => 'D0J1H6QTV'
|
|
32
|
-
)
|
|
33
|
-
client.send(:dispatch, event)
|
|
34
|
-
expect(im.is_open).to be true
|
|
20
|
+
expect(im.name).to eq 'beef'
|
|
35
21
|
end
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
22
|
+
|
|
23
|
+
context 'with im loaded in the store' do
|
|
24
|
+
include_context 'loaded client'
|
|
25
|
+
|
|
26
|
+
it 'im_open' do
|
|
27
|
+
im = client.ims['D0J1H6QTV']
|
|
28
|
+
expect(im).not_to be_nil
|
|
29
|
+
im.is_open = false
|
|
30
|
+
event = Slack::RealTime::Event.new(
|
|
31
|
+
'type' => 'im_open',
|
|
32
|
+
'channel' => 'D0J1H6QTV'
|
|
33
|
+
)
|
|
34
|
+
client.send(:dispatch, event)
|
|
35
|
+
expect(im.is_open).to be true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'im_close' do
|
|
39
|
+
im = client.ims['D0J1H6QTV']
|
|
40
|
+
expect(im).not_to be_nil
|
|
41
|
+
expect(im.is_open).to be true
|
|
42
|
+
event = Slack::RealTime::Event.new(
|
|
43
|
+
'type' => 'im_close',
|
|
44
|
+
'channel' => 'D0J1H6QTV'
|
|
45
|
+
)
|
|
46
|
+
client.send(:dispatch, event)
|
|
47
|
+
expect(im.is_open).to be false
|
|
48
|
+
end
|
|
46
49
|
end
|
|
47
50
|
end
|
|
48
51
|
end
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/
|
|
4
|
+
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_connect' } do
|
|
5
5
|
include_context 'connected client'
|
|
6
|
+
include_context 'loaded client'
|
|
6
7
|
|
|
7
|
-
context '
|
|
8
|
-
it 'sets
|
|
9
|
-
expect(client.
|
|
8
|
+
context 'private channel' do
|
|
9
|
+
it 'sets private channel data' do
|
|
10
|
+
expect(client.private_channels.count).to eq 1
|
|
10
11
|
end
|
|
12
|
+
|
|
11
13
|
it 'group_joined' do
|
|
12
|
-
expect(client.
|
|
14
|
+
expect(client.private_channels['CDEADBEEF']).to be_nil
|
|
13
15
|
event = Slack::RealTime::Event.new(
|
|
14
16
|
'type' => 'group_joined',
|
|
15
17
|
'channel' => {
|
|
@@ -18,43 +20,47 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
18
20
|
}
|
|
19
21
|
)
|
|
20
22
|
client.send(:dispatch, event)
|
|
21
|
-
|
|
22
|
-
expect(
|
|
23
|
-
expect(
|
|
23
|
+
channel = client.private_channels['CDEADBEEF']
|
|
24
|
+
expect(channel).not_to be_nil
|
|
25
|
+
expect(channel.name).to eq 'beef'
|
|
24
26
|
end
|
|
27
|
+
|
|
25
28
|
it 'group_left' do
|
|
26
|
-
|
|
27
|
-
expect(
|
|
29
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
30
|
+
expect(channel.members).to include client.self.id
|
|
28
31
|
event = Slack::RealTime::Event.new(
|
|
29
32
|
'type' => 'group_left',
|
|
30
33
|
'channel' => 'G0K7EV5A7'
|
|
31
34
|
)
|
|
32
35
|
client.send(:dispatch, event)
|
|
33
|
-
expect(
|
|
36
|
+
expect(client.private_channels['G0K7EV5A7']).to be_nil
|
|
34
37
|
end
|
|
38
|
+
|
|
35
39
|
it 'group_archive' do
|
|
36
|
-
|
|
37
|
-
expect(
|
|
40
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
41
|
+
expect(channel.is_archived).to be false
|
|
38
42
|
event = Slack::RealTime::Event.new(
|
|
39
43
|
'type' => 'group_archive',
|
|
40
44
|
'channel' => 'G0K7EV5A7'
|
|
41
45
|
)
|
|
42
46
|
client.send(:dispatch, event)
|
|
43
|
-
expect(
|
|
47
|
+
expect(channel.is_archived).to be true
|
|
44
48
|
end
|
|
49
|
+
|
|
45
50
|
it 'group_unarchive' do
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
52
|
+
channel.is_archived = true
|
|
48
53
|
event = Slack::RealTime::Event.new(
|
|
49
54
|
'type' => 'group_unarchive',
|
|
50
55
|
'channel' => 'G0K7EV5A7'
|
|
51
56
|
)
|
|
52
57
|
client.send(:dispatch, event)
|
|
53
|
-
expect(
|
|
58
|
+
expect(channel.is_archived).to be false
|
|
54
59
|
end
|
|
60
|
+
|
|
55
61
|
it 'group_rename' do
|
|
56
|
-
|
|
57
|
-
expect(
|
|
62
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
63
|
+
expect(channel.name).to eq 'mpdm-dblock--rubybot--player1-1'
|
|
58
64
|
event = Slack::RealTime::Event.new(
|
|
59
65
|
'type' => 'group_rename',
|
|
60
66
|
'channel' => {
|
|
@@ -64,28 +70,30 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
64
70
|
}
|
|
65
71
|
)
|
|
66
72
|
client.send(:dispatch, event)
|
|
67
|
-
expect(
|
|
73
|
+
expect(channel.name).to eq 'updated'
|
|
68
74
|
end
|
|
75
|
+
|
|
69
76
|
it 'group_open' do
|
|
70
|
-
|
|
71
|
-
expect(
|
|
77
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
78
|
+
expect(channel).not_to be_nil
|
|
72
79
|
event = Slack::RealTime::Event.new(
|
|
73
80
|
'type' => 'group_open',
|
|
74
81
|
'channel' => 'G0K7EV5A7'
|
|
75
82
|
)
|
|
76
83
|
client.send(:dispatch, event)
|
|
77
|
-
expect(
|
|
84
|
+
expect(channel.is_open).to be true
|
|
78
85
|
end
|
|
86
|
+
|
|
79
87
|
it 'group_close' do
|
|
80
|
-
|
|
81
|
-
expect(
|
|
82
|
-
|
|
88
|
+
channel = client.private_channels['G0K7EV5A7']
|
|
89
|
+
expect(channel).not_to be_nil
|
|
90
|
+
channel.is_open = true
|
|
83
91
|
event = Slack::RealTime::Event.new(
|
|
84
92
|
'type' => 'group_close',
|
|
85
93
|
'channel' => 'G0K7EV5A7'
|
|
86
94
|
)
|
|
87
95
|
client.send(:dispatch, event)
|
|
88
|
-
expect(
|
|
96
|
+
expect(channel.is_open).to be false
|
|
89
97
|
end
|
|
90
98
|
end
|
|
91
99
|
end
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/
|
|
4
|
+
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_connect' } do
|
|
5
5
|
include_context 'connected client'
|
|
6
|
+
include_context 'loaded client'
|
|
6
7
|
|
|
7
|
-
context 'channel' do
|
|
8
|
-
it 'sets channel data' do
|
|
9
|
-
expect(client.channels.count).to eq 156
|
|
10
|
-
end
|
|
8
|
+
context 'public channel' do
|
|
11
9
|
it 'channel_archive' do
|
|
12
|
-
channel = client.
|
|
10
|
+
channel = client.public_channels['C0HNTD0CW']
|
|
13
11
|
expect(channel.is_archived).to be false
|
|
14
12
|
event = Slack::RealTime::Event.new(
|
|
15
13
|
'type' => 'channel_archive',
|
|
@@ -19,36 +17,39 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
19
17
|
client.send(:dispatch, event)
|
|
20
18
|
expect(channel.is_archived).to be true
|
|
21
19
|
end
|
|
20
|
+
|
|
22
21
|
it 'channel_created' do
|
|
23
|
-
expect(client.
|
|
22
|
+
expect(client.public_channels['C024BE91L']).to be_nil
|
|
24
23
|
event = Slack::RealTime::Event.new(
|
|
25
24
|
'type' => 'channel_created',
|
|
26
25
|
'channel' => {
|
|
27
26
|
'id' => 'C024BE91L',
|
|
28
27
|
'name' => 'fun',
|
|
29
|
-
'created' =>
|
|
28
|
+
'created' => 1360782804,
|
|
30
29
|
'creator' => 'U04KB5WQR'
|
|
31
30
|
}
|
|
32
31
|
)
|
|
33
32
|
client.send(:dispatch, event)
|
|
34
|
-
channel = client.
|
|
35
|
-
expect(channel).not_to
|
|
33
|
+
channel = client.public_channels['C024BE91L']
|
|
34
|
+
expect(channel).not_to be_nil
|
|
36
35
|
expect(channel.name).to eq 'fun'
|
|
37
36
|
expect(channel.creator).to eq 'U04KB5WQR'
|
|
38
|
-
expect(channel.created).to eq
|
|
37
|
+
expect(channel.created).to eq 1360782804
|
|
39
38
|
end
|
|
39
|
+
|
|
40
40
|
it 'channel_deleted' do
|
|
41
|
-
expect(client.
|
|
41
|
+
expect(client.public_channels['C0HLE0BBL']).not_to be_nil
|
|
42
42
|
event = Slack::RealTime::Event.new(
|
|
43
43
|
'type' => 'channel_deleted',
|
|
44
44
|
'channel' => 'C0HLE0BBL'
|
|
45
45
|
)
|
|
46
46
|
client.send(:dispatch, event)
|
|
47
|
-
expect(client.
|
|
47
|
+
expect(client.public_channels['C0HLE0BBL']).to be_nil
|
|
48
48
|
end
|
|
49
|
+
|
|
49
50
|
context 'channel_joined' do
|
|
50
51
|
it 'creates channel' do
|
|
51
|
-
expect(client.
|
|
52
|
+
expect(client.public_channels['CDEADBEEF']).to be_nil
|
|
52
53
|
event = Slack::RealTime::Event.new(
|
|
53
54
|
'type' => 'channel_joined',
|
|
54
55
|
'channel' => {
|
|
@@ -57,13 +58,14 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
57
58
|
}
|
|
58
59
|
)
|
|
59
60
|
client.send(:dispatch, event)
|
|
60
|
-
channel = client.
|
|
61
|
-
expect(channel).not_to
|
|
61
|
+
channel = client.public_channels['CDEADBEEF']
|
|
62
|
+
expect(channel).not_to be_nil
|
|
62
63
|
expect(channel.name).to eq 'beef'
|
|
63
64
|
end
|
|
65
|
+
|
|
64
66
|
it 'updates channel' do
|
|
65
|
-
expect(client.
|
|
66
|
-
client.
|
|
67
|
+
expect(client.public_channels['CDEADBEEF']).to be_nil
|
|
68
|
+
client.public_channels['CDEADBEEF'] =
|
|
67
69
|
Slack::RealTime::Models::Channel.new('id' => 'CDEADBEEF', name: 'beef')
|
|
68
70
|
event = Slack::RealTime::Event.new(
|
|
69
71
|
'type' => 'channel_joined',
|
|
@@ -74,14 +76,14 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
74
76
|
}
|
|
75
77
|
)
|
|
76
78
|
client.send(:dispatch, event)
|
|
77
|
-
channel = client.
|
|
78
|
-
expect(channel).not_to
|
|
79
|
+
channel = client.public_channels['CDEADBEEF']
|
|
80
|
+
expect(channel).not_to be_nil
|
|
79
81
|
expect(channel.updated).to be true
|
|
80
82
|
end
|
|
81
83
|
end
|
|
82
84
|
|
|
83
85
|
it 'channel_left' do
|
|
84
|
-
channel = client.
|
|
86
|
+
channel = client.public_channels['C0JHNAB5H']
|
|
85
87
|
expect(channel.members).to include client.self.id
|
|
86
88
|
event = Slack::RealTime::Event.new(
|
|
87
89
|
'type' => 'channel_left',
|
|
@@ -90,8 +92,9 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
90
92
|
client.send(:dispatch, event)
|
|
91
93
|
expect(channel.members).not_to include client.self.id
|
|
92
94
|
end
|
|
95
|
+
|
|
93
96
|
it 'channel_rename' do
|
|
94
|
-
channel = client.
|
|
97
|
+
channel = client.public_channels['C0HLE0BBL']
|
|
95
98
|
expect(channel.name).to eq 'gifs'
|
|
96
99
|
event = Slack::RealTime::Event.new(
|
|
97
100
|
'type' => 'channel_rename',
|
|
@@ -104,8 +107,9 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
104
107
|
client.send(:dispatch, event)
|
|
105
108
|
expect(channel.name).to eq 'updated'
|
|
106
109
|
end
|
|
110
|
+
|
|
107
111
|
it 'channel_unarchive' do
|
|
108
|
-
channel = client.
|
|
112
|
+
channel = client.public_channels['C0HLE0BBL']
|
|
109
113
|
expect(channel.is_archived).to be true
|
|
110
114
|
event = Slack::RealTime::Event.new(
|
|
111
115
|
'type' => 'channel_unarchive',
|
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
|
|
4
4
|
[Slack::RealTime::Stores::Store, Slack::RealTime::Stores::Starter].each do |store_class|
|
|
5
|
-
|
|
6
|
-
RSpec.describe store_class, vcr: { cassette_name: cassette } do
|
|
5
|
+
RSpec.describe store_class, vcr: { cassette_name: 'web/rtm_connect' } do
|
|
7
6
|
include_context 'connected client', store_class: store_class
|
|
8
7
|
|
|
9
8
|
context 'team' do
|
|
10
|
-
it 'sets team data on rtm.
|
|
9
|
+
it 'sets team data on rtm.connect' do
|
|
11
10
|
expect(client.team.name).to eq 'dblock'
|
|
12
11
|
expect(client.team.domain).to eq 'dblockdotorg'
|
|
13
|
-
if store_class == Slack::RealTime::Stores::Store
|
|
14
|
-
expect(client.team.email_domain).to eq 'dblock.org'
|
|
15
|
-
expect(client.team.prefs.invites_only_admins).to be true
|
|
16
|
-
expect(client.team.plan).to eq ''
|
|
17
|
-
end
|
|
18
12
|
end
|
|
13
|
+
|
|
19
14
|
it 'team_domain_change' do
|
|
20
15
|
event = Slack::RealTime::Event.new(
|
|
21
16
|
'type' => 'team_domain_change',
|
|
@@ -26,6 +21,7 @@ require 'spec_helper'
|
|
|
26
21
|
expect(client.team.domain).to eq 'my'
|
|
27
22
|
expect(client.team['url']).to eq 'https://my.slack.com'
|
|
28
23
|
end
|
|
24
|
+
|
|
29
25
|
it 'email_domain_changed' do
|
|
30
26
|
event = Slack::RealTime::Event.new(
|
|
31
27
|
'type' => 'email_domain_changed',
|
|
@@ -34,6 +30,7 @@ require 'spec_helper'
|
|
|
34
30
|
client.send(:dispatch, event)
|
|
35
31
|
expect(client.team.email_domain).to eq 'example.com'
|
|
36
32
|
end
|
|
33
|
+
|
|
37
34
|
it 'team_pref_change' do
|
|
38
35
|
event = Slack::RealTime::Event.new(
|
|
39
36
|
'type' => 'team_pref_change',
|
|
@@ -43,6 +40,7 @@ require 'spec_helper'
|
|
|
43
40
|
client.send(:dispatch, event)
|
|
44
41
|
expect(client.team.prefs.invites_only_admins).to be false
|
|
45
42
|
end
|
|
43
|
+
|
|
46
44
|
it 'team_rename' do
|
|
47
45
|
event = Slack::RealTime::Event.new(
|
|
48
46
|
'type' => 'team_rename',
|
|
@@ -51,6 +49,7 @@ require 'spec_helper'
|
|
|
51
49
|
client.send(:dispatch, event)
|
|
52
50
|
expect(client.team.name).to eq 'New Team Name Inc.'
|
|
53
51
|
end
|
|
52
|
+
|
|
54
53
|
it 'team_plan_change' do
|
|
55
54
|
event = Slack::RealTime::Event.new(
|
|
56
55
|
'type' => 'team_plan_change',
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
|
|
4
|
-
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/
|
|
4
|
+
RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_connect' } do
|
|
5
5
|
include_context 'connected client'
|
|
6
|
+
include_context 'loaded client'
|
|
6
7
|
|
|
7
8
|
context 'user' do
|
|
8
|
-
it 'combines user and self data on rtm.start' do
|
|
9
|
-
expect(client.users['U0J1GAHN1'].name).to eq 'travis-ci'
|
|
10
|
-
expect(client.users['U0J1GAHN1']['prefs']['push_sound']).to eq 'b2.mp3'
|
|
11
|
-
end
|
|
12
9
|
it 'user_change' do
|
|
13
10
|
expect(client.users['U07KECJ77'].name).to eq 'aws'
|
|
14
11
|
event = Slack::RealTime::Event.new(
|
|
@@ -20,6 +17,7 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
20
17
|
client.send(:dispatch, event)
|
|
21
18
|
expect(client.users['U07KECJ77'].name).to eq 'renamed'
|
|
22
19
|
end
|
|
20
|
+
|
|
23
21
|
it 'team_join' do
|
|
24
22
|
expect do
|
|
25
23
|
event = Slack::RealTime::Event.new(
|
|
@@ -32,6 +30,7 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
32
30
|
end.to change(client.users, :count).by(1)
|
|
33
31
|
expect(client.users['DEADBEEF'].name).to eq 'added'
|
|
34
32
|
end
|
|
33
|
+
|
|
35
34
|
it 'pref_change' do
|
|
36
35
|
event = Slack::RealTime::Event.new(
|
|
37
36
|
'type' => 'pref_change',
|
|
@@ -41,6 +40,7 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
41
40
|
client.send(:dispatch, event)
|
|
42
41
|
expect(client.self.prefs['push_sound']).to eq 'updated.mp3'
|
|
43
42
|
end
|
|
43
|
+
|
|
44
44
|
it 'presence_change' do
|
|
45
45
|
expect(client.users['U07KECJ77'].presence).to eq 'away'
|
|
46
46
|
event = Slack::RealTime::Event.new(
|
|
@@ -51,6 +51,7 @@ RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' }
|
|
|
51
51
|
client.send(:dispatch, event)
|
|
52
52
|
expect(client.users['U07KECJ77'].presence).to eq 'updated'
|
|
53
53
|
end
|
|
54
|
+
|
|
54
55
|
it 'manual_presence_change' do
|
|
55
56
|
expect(client.self['presence']).to eq 'away'
|
|
56
57
|
event = Slack::RealTime::Event.new(
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Slack::RealTime::Stores::Store do
|
|
6
|
+
it 'can be initialized with an empty hash' do
|
|
7
|
+
store = described_class.new(Hashie::Mash.new)
|
|
8
|
+
expect(store.team).to be_nil
|
|
9
|
+
expect(store.teams.count).to eq 0
|
|
10
|
+
expect(store.self).to be_nil
|
|
11
|
+
expect(store.public_channels.count).to eq 0
|
|
12
|
+
expect(store.private_channels.count).to eq 0
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'includes event handlers in subclasses' do
|
|
16
|
+
subclass = Class.new(described_class)
|
|
17
|
+
expect(subclass.events.key?('channel_created')).to be true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
context 'with client started' do
|
|
21
|
+
let(:client) { Slack::RealTime::Client.new(store_class: described_class, concurrency: Slack::RealTime::Concurrency::Mock) }
|
|
22
|
+
|
|
23
|
+
before do
|
|
24
|
+
client.store = described_class.new(Hashie::Mash.new, { caches: :all })
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'initializes itself with data' do
|
|
28
|
+
team_info = Hashie::Mash.new(team: {})
|
|
29
|
+
allow(client.web_client).to receive(:team_info).and_return(team_info)
|
|
30
|
+
expect(client.web_client).to receive(:team_info)
|
|
31
|
+
expect(client.web_client).to receive(:users_list)
|
|
32
|
+
expect(client.web_client).to receive(:conversations_list).with(types: 'public_channel,private_channel,im,mpim')
|
|
33
|
+
event = Slack::RealTime::Event.new('type' => 'hello', 'start' => true)
|
|
34
|
+
client.send(:dispatch, event)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'when configured to only cache some types' do
|
|
38
|
+
before do
|
|
39
|
+
client.store = described_class.new(Hashie::Mash.new, { caches: %i[users public_channels] })
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'initializes specified caches with data' do
|
|
43
|
+
expect(client.web_client).to receive(:users_list)
|
|
44
|
+
expect(client.web_client).to receive(:conversations_list).with(types: 'public_channel')
|
|
45
|
+
event = Slack::RealTime::Event.new('type' => 'hello', 'start' => true)
|
|
46
|
+
client.send(:dispatch, event)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/spec/slack/slack_spec.rb
CHANGED
|
@@ -22,7 +22,7 @@ describe Slack do
|
|
|
22
22
|
context 'globals' do
|
|
23
23
|
let(:command) do
|
|
24
24
|
"\"#{slack}\" --vcr-cassette-name=web/auth_test_success " \
|
|
25
|
-
|
|
25
|
+
'--slack-api-token=token -d auth test 2>&1'
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'enables request and response logging with -d' do
|
|
@@ -30,6 +30,7 @@ describe Slack do
|
|
|
30
30
|
expect(output).to include 'POST https://slack.com/api/auth.test'
|
|
31
31
|
expect(output).to include 'Status 200'
|
|
32
32
|
end
|
|
33
|
+
|
|
33
34
|
it 'requires --slack-api-token' do
|
|
34
35
|
err = `"#{slack}" auth test 2>&1`
|
|
35
36
|
expect(err).to(
|
|
@@ -44,7 +45,7 @@ describe Slack do
|
|
|
44
45
|
context 'bad auth' do
|
|
45
46
|
let(:command) do
|
|
46
47
|
"\"#{slack}\" --vcr-cassette-name=web/auth_test_error " \
|
|
47
|
-
|
|
48
|
+
'--slack-api-token=token auth test 2>&1'
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
it 'fails with an exception' do
|
|
@@ -56,7 +57,7 @@ describe Slack do
|
|
|
56
57
|
context 'good auth' do
|
|
57
58
|
let(:command) do
|
|
58
59
|
"\"#{slack}\" --vcr-cassette-name=web/auth_test_success " \
|
|
59
|
-
|
|
60
|
+
'--slack-api-token=token auth test 2>&1'
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
it 'succeeds' do
|
|
@@ -79,7 +80,7 @@ describe Slack do
|
|
|
79
80
|
describe '#users' do
|
|
80
81
|
let(:command) do
|
|
81
82
|
"\"#{slack}\" --vcr-cassette-name=web/users_list " \
|
|
82
|
-
|
|
83
|
+
'--slack-api-token=token users list --presence=true 2>&1'
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
it 'list' do
|
data/spec/slack/version_spec.rb
CHANGED
|
@@ -5,4 +5,9 @@ require 'spec_helper'
|
|
|
5
5
|
|
|
6
6
|
RSpec.describe Slack::Web::Api::Endpoints::AdminAppsRequests do
|
|
7
7
|
let(:client) { Slack::Web::Client.new }
|
|
8
|
+
context 'admin.apps.requests_cancel' do
|
|
9
|
+
it 'requires request_id' do
|
|
10
|
+
expect { client.admin_apps_requests_cancel }.to raise_error ArgumentError, /Required arguments :request_id missing/
|
|
11
|
+
end
|
|
12
|
+
end
|
|
8
13
|
end
|
|
@@ -10,11 +10,34 @@ RSpec.describe Slack::Web::Api::Endpoints::AdminConversations do
|
|
|
10
10
|
expect { client.admin_conversations_archive }.to raise_error ArgumentError, /Required arguments :channel_id missing/
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
|
+
context 'admin.conversations_bulkArchive' do
|
|
14
|
+
it 'requires channel_ids' do
|
|
15
|
+
expect { client.admin_conversations_bulkArchive }.to raise_error ArgumentError, /Required arguments :channel_ids missing/
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
context 'admin.conversations_bulkDelete' do
|
|
19
|
+
it 'requires channel_ids' do
|
|
20
|
+
expect { client.admin_conversations_bulkDelete }.to raise_error ArgumentError, /Required arguments :channel_ids missing/
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
context 'admin.conversations_bulkMove' do
|
|
24
|
+
it 'requires channel_ids' do
|
|
25
|
+
expect { client.admin_conversations_bulkMove(target_team_id: %q[]) }.to raise_error ArgumentError, /Required arguments :channel_ids missing/
|
|
26
|
+
end
|
|
27
|
+
it 'requires target_team_id' do
|
|
28
|
+
expect { client.admin_conversations_bulkMove(channel_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :target_team_id missing/
|
|
29
|
+
end
|
|
30
|
+
end
|
|
13
31
|
context 'admin.conversations_convertToPrivate' do
|
|
14
32
|
it 'requires channel_id' do
|
|
15
33
|
expect { client.admin_conversations_convertToPrivate }.to raise_error ArgumentError, /Required arguments :channel_id missing/
|
|
16
34
|
end
|
|
17
35
|
end
|
|
36
|
+
context 'admin.conversations_convertToPublic' do
|
|
37
|
+
it 'requires channel_id' do
|
|
38
|
+
expect { client.admin_conversations_convertToPublic }.to raise_error ArgumentError, /Required arguments :channel_id missing/
|
|
39
|
+
end
|
|
40
|
+
end
|
|
18
41
|
context 'admin.conversations_create' do
|
|
19
42
|
it 'requires is_private' do
|
|
20
43
|
expect { client.admin_conversations_create(name: %q[]) }.to raise_error ArgumentError, /Required arguments :is_private missing/
|
|
@@ -56,6 +79,14 @@ RSpec.describe Slack::Web::Api::Endpoints::AdminConversations do
|
|
|
56
79
|
expect { client.admin_conversations_invite(channel_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_ids missing/
|
|
57
80
|
end
|
|
58
81
|
end
|
|
82
|
+
context 'admin.conversations_lookup' do
|
|
83
|
+
it 'requires last_message_activity_before' do
|
|
84
|
+
expect { client.admin_conversations_lookup(team_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :last_message_activity_before missing/
|
|
85
|
+
end
|
|
86
|
+
it 'requires team_ids' do
|
|
87
|
+
expect { client.admin_conversations_lookup(last_message_activity_before: %q[]) }.to raise_error ArgumentError, /Required arguments :team_ids missing/
|
|
88
|
+
end
|
|
89
|
+
end
|
|
59
90
|
context 'admin.conversations_removeCustomRetention' do
|
|
60
91
|
it 'requires channel_id' do
|
|
61
92
|
expect { client.admin_conversations_removeCustomRetention }.to raise_error ArgumentError, /Required arguments :channel_id missing/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
|
3
|
+
|
|
4
|
+
require 'spec_helper'
|
|
5
|
+
|
|
6
|
+
RSpec.describe Slack::Web::Api::Endpoints::AdminRoles do
|
|
7
|
+
let(:client) { Slack::Web::Client.new }
|
|
8
|
+
context 'admin.roles_addAssignments' do
|
|
9
|
+
it 'requires entity_ids' do
|
|
10
|
+
expect { client.admin_roles_addAssignments(role_id: %q[], user_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :entity_ids missing/
|
|
11
|
+
end
|
|
12
|
+
it 'requires role_id' do
|
|
13
|
+
expect { client.admin_roles_addAssignments(entity_ids: %q[], user_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :role_id missing/
|
|
14
|
+
end
|
|
15
|
+
it 'requires user_ids' do
|
|
16
|
+
expect { client.admin_roles_addAssignments(entity_ids: %q[], role_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_ids missing/
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
context 'admin.roles_removeAssignments' do
|
|
20
|
+
it 'requires entity_ids' do
|
|
21
|
+
expect { client.admin_roles_removeAssignments(role_id: %q[], user_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :entity_ids missing/
|
|
22
|
+
end
|
|
23
|
+
it 'requires role_id' do
|
|
24
|
+
expect { client.admin_roles_removeAssignments(entity_ids: %q[], user_ids: %q[]) }.to raise_error ArgumentError, /Required arguments :role_id missing/
|
|
25
|
+
end
|
|
26
|
+
it 'requires user_ids' do
|
|
27
|
+
expect { client.admin_roles_removeAssignments(entity_ids: %q[], role_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_ids missing/
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|