aboutsummaryrefslogtreecommitdiff
path: root/t/30-room.t
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2021-07-08 17:22:38 -0300
committerMatias Linares <matiaslina@gmail.com>2021-07-08 17:25:36 -0300
commit7e3b798983fa11352fb19fe382b7a1217c8dbce3 (patch)
treeda2e85b2ea56374f6babd3c2d27573dd02ba7387 /t/30-room.t
parent46f9a0d6c1b55413c9cf097a12b7434bbe8e6336 (diff)
downloadperl6-matrix-client-7e3b798983fa11352fb19fe382b7a1217c8dbce3.tar.gz
Fix params with dashes
Couple of endpoints were passing parameters with dash on the JSON body intead of an underscore. This fixes he following methods: - ban - unban - invite - kick
Diffstat (limited to 't/30-room.t')
-rw-r--r--t/30-room.t31
1 files changed, 30 insertions, 1 deletions
diff --git a/t/30-room.t b/t/30-room.t
index 7eb9dd7..f5b653e 100644
--- a/t/30-room.t
+++ b/t/30-room.t
@@ -1,7 +1,7 @@
use lib 'lib';
use Test;
use Matrix::Client;
-plan 12;
+plan 14;
use-ok 'Matrix::Client::Room';
@@ -107,3 +107,32 @@ subtest 'name' => {
$test-room.leave;
};
+
+subtest 'ban' => {
+ plan 2;
+ my Matrix::Client $new-user-client .= new(:$home-server);
+ my $new-username = ('a'..'z').pick(20).join;
+ $new-user-client.register($new-username, 'password');
+ $new-user-client.join-room($public-room-id);
+ my $user-id = $new-user-client.whoami;
+
+ my $room = $client.create-room(
+ :public,
+ :preset<public_chat>,
+ :name("The Grand Duke Pub"),
+ :topic("All about happy hour"),
+ :creation_content({
+ "m.federate" => False
+ })
+ );
+
+ $new-user-client.join-room($room.id);
+
+ lives-ok {
+ $room.ban($user-id, :reason<testing>)
+ }, 'can ban usernames';
+
+ lives-ok {
+ $room.unban($user-id, :reason<testing>);
+ }, 'can unban';
+}