Skip to content

Commit

Permalink
integrate chatroom whitelist api
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin91 committed Mar 10, 2018
1 parent 4caf8da commit 1de42b5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/rong_cloud/services/message_priority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ def remove_chatroom_message_priority(object_name)
def chatroom_message_priorities
request("/chatroom/message/priority/query")
end

def add_chatroom_message_whitelist(object_names)
request("/chatroom/whitelist/add", objectnames: object_names)
end

def remove_chatroom_message_whitelist(object_names)
request("/chatroom/whitelist/delete", objectnames: object_names)
end

def chatroom_message_whitelist
request("/chatroom/whitelist/query")
end
end
end
end
22 changes: 21 additions & 1 deletion test/rong_cloud/services/message_priority_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Services
class MessagePriorityTest < Minitest::Test
include RongCloud::ServiceTestSetup

def test_add_message_priority_flow
def test_chatroom_message_priority_flow
response = @service.add_chatroom_message_priority("RC:CmdMsg")
assert_equal 200, response["code"]

Expand All @@ -24,6 +24,26 @@ def test_add_message_priority_flow
response = @service.chatroom_message_priorities
assert_empty response["objectNames"]
end

def test_chatroom_message_whitelist_flow
response = @service.add_chatroom_message_whitelist("RC:TxtMsg")
assert_equal 200, response["code"]

response = @service.add_chatroom_message_whitelist(["RC:ImgMsg", "RC:LBSMsg"])
assert_equal 200, response["code"]

response = @service.chatroom_message_whitelist
assert_equal ["RC:TxtMsg", "RC:ImgMsg", "RC:LBSMsg"].sort, response["whitlistMsgType"].sort

response = @service.remove_chatroom_message_whitelist(["RC:ImgMsg", "RC:LBSMsg"])
assert_equal 200, response["code"]

response = @service.remove_chatroom_message_whitelist("RC:TxtMsg")
assert_equal 200, response["code"]

response = @service.chatroom_message_whitelist
assert_equal [""], response["whitlistMsgType"]
end
end
end
end

0 comments on commit 1de42b5

Please sign in to comment.