Skip to content

Commit 9b34b6b

Browse files
authored
Stop testing unspecced POST /send (#1419)
For element-hq/synapse#19557 --------- Signed-off-by: Tulir Asokan <tulir@maunium.net>
1 parent 1be04cc commit 9b34b6b

5 files changed

Lines changed: 29 additions & 46 deletions

File tree

tests/10apidoc/34room-messages.pl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,3 @@
1-
test "POST /rooms/:room_id/send/:event_type sends a message",
2-
deprecated_endpoints => 1,
3-
requires => [ local_user_and_room_fixtures() ],
4-
5-
do => sub {
6-
my ( $user, $room_id ) = @_;
7-
8-
do_request_json_for( $user,
9-
method => "POST",
10-
uri => "/v3/rooms/$room_id/send/m.room.message",
11-
12-
content => { msgtype => "m.message", body => "Here is the message content" },
13-
)->then( sub {
14-
my ( $body ) = @_;
15-
16-
assert_json_keys( $body, qw( event_id ));
17-
assert_json_nonempty_string( $body->{event_id} );
18-
19-
Future->done(1);
20-
});
21-
};
22-
231
test "PUT /rooms/:room_id/send/:event_type/:txn_id sends a message",
242
requires => [ local_user_and_room_fixtures() ],
253

tests/32room-versions.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@
228228

229229
do_request_json_for(
230230
$remote,
231-
method => "POST",
232-
uri => "/v3/rooms/$room_id/redact/$to_redact",
231+
method => "PUT",
232+
uri => "/v3/rooms/$room_id/redact/$to_redact/$to_redact",
233233
content => {},
234234
);
235235
})->then( sub {

tests/60app-services/02ghost.pl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
my $user_fixture = local_user_fixture( with_events => 1 );
22

3+
sub random_transaction_id
4+
{
5+
join "", map { chr( 65 + rand 26 )} 1 .. 20;
6+
}
7+
38
multi_test "AS-ghosted users can use rooms via AS",
49
requires => [ as_ghost_fixture(), $main::AS_USER[0], $user_fixture, $main::APPSERV[0],
510
room_fixture( $user_fixture ),
@@ -57,8 +62,8 @@
5762
}),
5863

5964
do_request_json_for( $as_user,
60-
method => "POST",
61-
uri => "/v3/rooms/$room_id/send/m.room.message",
65+
method => "PUT",
66+
uri => "/v3/rooms/$room_id/send/m.room.message/" . random_transaction_id(),
6267
params => {
6368
user_id => $ghost->user_id,
6469
},

tests/80torture/03events.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767

6868
Future->needs_all(
6969
do_request_json_for( $user,
70-
method => "POST",
71-
uri => "/v3/rooms/$room_id/send/m.room.message",
70+
method => "PUT",
71+
uri => "/v3/rooms/$room_id/send/m.room.message/aaaaaaa",
7272
content => {
7373
msgtype => "m.text",
7474
body => "A" x 70000,

tests/80torture/20json.pl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
Future->needs_all(
1111
do_request_json_for( $user,
12-
method => "POST",
13-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
12+
method => "PUT",
13+
uri => "/v3/rooms/$room_id/send/sytest.dummy/253",
1414
content => {
1515
msgtype => "sytest.dummy",
1616
body => 9007199254740992, # 2 ** 53
1717
},
1818
)->main::expect_m_bad_json,
1919

2020
do_request_json_for( $user,
21-
method => "POST",
22-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
21+
method => "PUT",
22+
uri => "/v3/rooms/$room_id/send/sytest.dummy/-253",
2323
content => {
2424
msgtype => "sytest.dummy",
2525
body => -9007199254740992, # -2 ** 53
@@ -38,8 +38,8 @@
3838
my ( $user, $room_id ) = @_;
3939

4040
do_request_json_for( $user,
41-
method => "POST",
42-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
41+
method => "PUT",
42+
uri => "/v3/rooms/$room_id/send/sytest.dummy/1.1",
4343
content => {
4444
msgtype => "sytest.dummy",
4545
body => 1.1,
@@ -66,26 +66,26 @@
6666
Future->needs_all(
6767
# Try some Perl magic values.
6868
do_request_json_for( $user,
69-
method => "POST",
70-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
69+
method => "PUT",
70+
uri => "/v3/rooms/$room_id/send/sytest.dummy/NaN",
7171
content => {
7272
msgtype => "sytest.dummy",
7373
body => "NaN" + 0,
7474
},
7575
)->main::expect_http_400,
7676

7777
do_request_json_for( $user,
78-
method => "POST",
79-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
78+
method => "PUT",
79+
uri => "/v3/rooms/$room_id/send/sytest.dummy/inf",
8080
content => {
8181
msgtype => "sytest.dummy",
8282
body => "inf" + 0,
8383
},
8484
)->main::expect_http_400,
8585

8686
do_request_json_for( $user,
87-
method => "POST",
88-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
87+
method => "PUT",
88+
uri => "/v3/rooms/$room_id/send/sytest.dummy/-inf",
8989
content => {
9090
msgtype => "sytest.dummy",
9191
body => "-inf" + 0,
@@ -94,8 +94,8 @@
9494

9595
# Try some Python magic values.
9696
$user->http->do_request(
97-
method => "POST",
98-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
97+
method => "PUT",
98+
uri => "/v3/rooms/$room_id/send/sytest.dummy/Infinity",
9999
params => {
100100
access_token => $user->access_token,
101101
},
@@ -104,8 +104,8 @@
104104
)->main::expect_http_400,
105105

106106
$user->http->do_request(
107-
method => "POST",
108-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
107+
method => "PUT",
108+
uri => "/v3/rooms/$room_id/send/sytest.dummy/-Infinity",
109109
params => {
110110
access_token => $user->access_token,
111111
},
@@ -114,8 +114,8 @@
114114
)->main::expect_http_400,
115115

116116
$user->http->do_request(
117-
method => "POST",
118-
uri => "/v3/rooms/$room_id/send/sytest.dummy",
117+
method => "PUT",
118+
uri => "/v3/rooms/$room_id/send/sytest.dummy/NaNBody",
119119
params => {
120120
access_token => $user->access_token,
121121
},

0 commit comments

Comments
 (0)