summaryrefslogtreecommitdiff
path: root/test/polyjuice/client/sync_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/polyjuice/client/sync_test.exs')
-rw-r--r--test/polyjuice/client/sync_test.exs19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/polyjuice/client/sync_test.exs b/test/polyjuice/client/sync_test.exs
index b1f2752..c1b4f64 100644
--- a/test/polyjuice/client/sync_test.exs
+++ b/test/polyjuice/client/sync_test.exs
@@ -17,7 +17,7 @@ defmodule Polyjuice.Client.SyncTest do
defmodule Httpd do
def _matrix(session_id, env, input) do
- # FIXME: check authorization header
+ assert Keyword.get(env, :http_authorization) == 'Bearer an_access_token'
# FIXME: check method
[path | _] =
Keyword.get(env, :path_info)
@@ -213,13 +213,14 @@ defmodule Polyjuice.Client.SyncTest do
port = :httpd.info(httpd_pid) |> Keyword.fetch!(:port)
- client = %Polyjuice.Client{
- base_url: "http://127.0.0.1:#{port}/Elixir.Polyjuice.Client.SyncTest.Httpd",
- access_token: "an_access_token",
- user_id: "@alice:example.org",
- storage: storage,
- test: true
- }
+ client =
+ Polyjuice.Client.start(
+ "http://127.0.0.1:#{port}/Elixir.Polyjuice.Client.SyncTest.Httpd",
+ access_token: "an_access_token",
+ user_id: "@alice:example.org",
+ storage: storage,
+ test: true
+ )
{:ok, sync_pid} =
Polyjuice.Client.API.sync_child_spec(client, self(), filter: %{})
@@ -307,6 +308,8 @@ defmodule Polyjuice.Client.SyncTest do
Process.unlink(sync_pid)
Process.exit(sync_pid, :kill)
+ Polyjuice.Client.stop(client)
+
:inets.stop(:httpd, httpd_pid)
after
Polyjuice.Client.Storage.close(storage)