summaryrefslogtreecommitdiff
path: root/test/polyjuice/client/endpoint
diff options
context:
space:
mode:
Diffstat (limited to 'test/polyjuice/client/endpoint')
-rw-r--r--test/polyjuice/client/endpoint/get_rooms_messages_test.exs12
-rw-r--r--test/polyjuice/client/endpoint/get_rooms_state_test.exs8
-rw-r--r--test/polyjuice/client/endpoint/get_sync_test.exs23
-rw-r--r--test/polyjuice/client/endpoint/post_join_test.exs10
-rw-r--r--test/polyjuice/client/endpoint/post_login_test.exs4
-rw-r--r--test/polyjuice/client/endpoint/post_logout_test.exs4
-rw-r--r--test/polyjuice/client/endpoint/post_rooms_receipt_test.exs5
-rw-r--r--test/polyjuice/client/endpoint/post_user_filter_test.exs4
-rw-r--r--test/polyjuice/client/endpoint/put_rooms_send_test.exs5
-rw-r--r--test/polyjuice/client/endpoint/put_rooms_state_test.exs4
10 files changed, 42 insertions, 37 deletions
diff --git a/test/polyjuice/client/endpoint/get_rooms_messages_test.exs b/test/polyjuice/client/endpoint/get_rooms_messages_test.exs
index 6d2002c..f1d8787 100644
--- a/test/polyjuice/client/endpoint/get_rooms_messages_test.exs
+++ b/test/polyjuice/client/endpoint/get_rooms_messages_test.exs
@@ -21,7 +21,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsMessagesTest do
from: "token",
dir: :forward
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -30,8 +30,8 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsMessagesTest do
{"Accept", "application/json"}
],
method: :get,
- url:
- "https://example.com/_matrix/client/r0/rooms/%21roomid/messages?from=token&dir=f"
+ path: "_matrix/client/r0/rooms/%21roomid/messages",
+ query: [from: "token", dir: "f"]
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
@@ -59,7 +59,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsMessagesTest do
limit: 20,
filter: %{}
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -68,8 +68,8 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsMessagesTest do
{"Accept", "application/json"}
],
method: :get,
- url:
- "https://example.com/_matrix/client/r0/rooms/%21roomid/messages?from=token&dir=b&to=endtoken&limit=20&filter=%7B%7D"
+ path: "_matrix/client/r0/rooms/%21roomid/messages",
+ query: [from: "token", dir: "b", to: "endtoken", limit: 20, filter: "{}"]
}
end
end
diff --git a/test/polyjuice/client/endpoint/get_rooms_state_test.exs b/test/polyjuice/client/endpoint/get_rooms_state_test.exs
index ec7911f..3c59b80 100644
--- a/test/polyjuice/client/endpoint/get_rooms_state_test.exs
+++ b/test/polyjuice/client/endpoint/get_rooms_state_test.exs
@@ -22,7 +22,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsStateTest do
state_key: ""
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -31,7 +31,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsStateTest do
{"Accept", "application/json"}
],
method: :get,
- url: "https://example.com/_matrix/client/r0/rooms/%21room_id/state"
+ path: "_matrix/client/r0/rooms/%21room_id/state"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
@@ -57,7 +57,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsStateTest do
state_key: ""
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -66,7 +66,7 @@ defmodule Polyjuice.Client.Endpoint.GetRoomsStateTest do
{"Accept", "application/json"}
],
method: :get,
- url: "https://example.com/_matrix/client/r0/rooms/%21room_id/state/m.room.name/"
+ path: "_matrix/client/r0/rooms/%21room_id/state/m.room.name/"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/get_sync_test.exs b/test/polyjuice/client/endpoint/get_sync_test.exs
index ae03aed..02aa580 100644
--- a/test/polyjuice/client/endpoint/get_sync_test.exs
+++ b/test/polyjuice/client/endpoint/get_sync_test.exs
@@ -17,7 +17,7 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
test "GET sync" do
with endpoint = %Polyjuice.Client.Endpoint.GetSync{} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -26,7 +26,8 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
{"Accept", "application/json"}
],
method: :get,
- url: "https://example.com/_matrix/client/r0/sync?timeout=0"
+ path: "_matrix/client/r0/sync",
+ query: [timeout: 0]
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
@@ -53,7 +54,7 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
set_presence: :offline,
timeout: 120
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -62,8 +63,14 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
{"Accept", "application/json"}
],
method: :get,
- url:
- "https://example.com/_matrix/client/r0/sync?timeout=120&since=token&full_state=true&filter=1&set_presence=offline"
+ path: "_matrix/client/r0/sync",
+ query: [
+ timeout: 120,
+ since: "token",
+ full_state: "true",
+ filter: "1",
+ set_presence: "offline"
+ ]
}
end
@@ -71,7 +78,7 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
filter: %{},
set_presence: :unavailable
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -80,8 +87,8 @@ defmodule Polyjuice.Client.Endpoint.GetSyncTest do
{"Accept", "application/json"}
],
method: :get,
- url:
- "https://example.com/_matrix/client/r0/sync?timeout=0&filter=%7B%7D&set_presence=unavailable"
+ path: "_matrix/client/r0/sync",
+ query: [timeout: 0, filter: "{}", set_presence: "unavailable"]
}
end
end
diff --git a/test/polyjuice/client/endpoint/post_join_test.exs b/test/polyjuice/client/endpoint/post_join_test.exs
index fef86b1..9f21c52 100644
--- a/test/polyjuice/client/endpoint/post_join_test.exs
+++ b/test/polyjuice/client/endpoint/post_join_test.exs
@@ -29,7 +29,7 @@ defmodule Polyjuice.Client.Endpoint.PostJoinTest do
}
}
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert %{http_spec | body: nil} == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -39,7 +39,7 @@ defmodule Polyjuice.Client.Endpoint.PostJoinTest do
{"Content-Type", "application/json"}
],
method: :post,
- url: "https://example.com/_matrix/client/r0/join/%21room"
+ path: "_matrix/client/r0/join/%21room"
}
assert Jason.decode!(http_spec.body) == %{
@@ -76,7 +76,7 @@ defmodule Polyjuice.Client.Endpoint.PostJoinTest do
room: "!room",
servers: ["example.com", "example.org"]
} do
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -86,8 +86,8 @@ defmodule Polyjuice.Client.Endpoint.PostJoinTest do
{"Content-Type", "application/json"}
],
method: :post,
- url:
- "https://example.com/_matrix/client/r0/join/%21room?server_name=example.com&server_name=example.org"
+ path: "_matrix/client/r0/join/%21room",
+ query: [server_name: "example.com", server_name: "example.org"]
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/post_login_test.exs b/test/polyjuice/client/endpoint/post_login_test.exs
index 6bf7781..4a2fa96 100644
--- a/test/polyjuice/client/endpoint/post_login_test.exs
+++ b/test/polyjuice/client/endpoint/post_login_test.exs
@@ -25,7 +25,7 @@ defmodule Polyjuice.Client.Endpoint.PostLoginTest do
password: "12345"
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert %{http_spec | body: nil} == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: false,
@@ -35,7 +35,7 @@ defmodule Polyjuice.Client.Endpoint.PostLoginTest do
{"Content-Type", "application/json"}
],
method: :post,
- url: "https://example.com/_matrix/client/r0/login"
+ path: "_matrix/client/r0/login"
}
assert Jason.decode!(http_spec.body) == %{
diff --git a/test/polyjuice/client/endpoint/post_logout_test.exs b/test/polyjuice/client/endpoint/post_logout_test.exs
index 9dde596..07c8211 100644
--- a/test/polyjuice/client/endpoint/post_logout_test.exs
+++ b/test/polyjuice/client/endpoint/post_logout_test.exs
@@ -18,7 +18,7 @@ defmodule Polyjuice.Client.Endpoint.PostLogoutTest do
test "POST logout" do
endpoint = %Polyjuice.Client.Endpoint.PostLogout{}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -28,7 +28,7 @@ defmodule Polyjuice.Client.Endpoint.PostLogoutTest do
{"Content-Type", "application/json"}
],
method: :post,
- url: "https://example.com/_matrix/client/r0/logout"
+ path: "_matrix/client/r0/logout"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/post_rooms_receipt_test.exs b/test/polyjuice/client/endpoint/post_rooms_receipt_test.exs
index 39a7453..fdb9490 100644
--- a/test/polyjuice/client/endpoint/post_rooms_receipt_test.exs
+++ b/test/polyjuice/client/endpoint/post_rooms_receipt_test.exs
@@ -21,7 +21,7 @@ defmodule Polyjuice.Client.Endpoint.PostRoomsReceiptTest do
event_id: "$event_id"
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert http_spec == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -31,8 +31,7 @@ defmodule Polyjuice.Client.Endpoint.PostRoomsReceiptTest do
{"Content-Type", "application/json"}
],
method: :post,
- url:
- "https://example.com/_matrix/client/r0/rooms/%21room_id/receipt/m.read/%24event_id"
+ path: "_matrix/client/r0/rooms/%21room_id/receipt/m.read/%24event_id"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/post_user_filter_test.exs b/test/polyjuice/client/endpoint/post_user_filter_test.exs
index 947474c..947aa1e 100644
--- a/test/polyjuice/client/endpoint/post_user_filter_test.exs
+++ b/test/polyjuice/client/endpoint/post_user_filter_test.exs
@@ -25,7 +25,7 @@ defmodule Polyjuice.Client.Endpoint.PostUserfilterTest do
}
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert TestUtil.http_spec_body_to_binary(http_spec) == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -35,7 +35,7 @@ defmodule Polyjuice.Client.Endpoint.PostUserfilterTest do
{"Content-Type", "application/json"}
],
method: :post,
- url: "https://example.com/_matrix/client/r0/user/%40alice%3Aexample.com/filter"
+ path: "_matrix/client/r0/user/%40alice%3Aexample.com/filter"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/put_rooms_send_test.exs b/test/polyjuice/client/endpoint/put_rooms_send_test.exs
index eeee870..db4a4bc 100644
--- a/test/polyjuice/client/endpoint/put_rooms_send_test.exs
+++ b/test/polyjuice/client/endpoint/put_rooms_send_test.exs
@@ -25,7 +25,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsSendTest do
}
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert TestUtil.http_spec_body_to_binary(http_spec) == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -35,8 +35,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsSendTest do
{"Content-Type", "application/json"}
],
method: :put,
- url:
- "https://example.com/_matrix/client/r0/rooms/%21room_id/send/m.room.message/txn_id"
+ path: "_matrix/client/r0/rooms/%21room_id/send/m.room.message/txn_id"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(
diff --git a/test/polyjuice/client/endpoint/put_rooms_state_test.exs b/test/polyjuice/client/endpoint/put_rooms_state_test.exs
index 690c885..cb745e3 100644
--- a/test/polyjuice/client/endpoint/put_rooms_state_test.exs
+++ b/test/polyjuice/client/endpoint/put_rooms_state_test.exs
@@ -25,7 +25,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsStateTest do
}
}
- http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint, "https://example.com")
+ http_spec = Polyjuice.Client.Endpoint.Proto.http_spec(endpoint)
assert TestUtil.http_spec_body_to_binary(http_spec) == %Polyjuice.Client.Endpoint.HttpSpec{
auth_required: true,
@@ -35,7 +35,7 @@ defmodule Polyjuice.Client.Endpoint.PutRoomsStateTest do
{"Content-Type", "application/json"}
],
method: :put,
- url: "https://example.com/_matrix/client/r0/rooms/%21room_id/state/m.room.name/"
+ path: "_matrix/client/r0/rooms/%21room_id/state/m.room.name/"
}
assert Polyjuice.Client.Endpoint.Proto.transform_http_result(