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.exs26
1 files changed, 17 insertions, 9 deletions
diff --git a/test/polyjuice/client/sync_test.exs b/test/polyjuice/client/sync_test.exs
index ae86fa4..e1085d6 100644
--- a/test/polyjuice/client/sync_test.exs
+++ b/test/polyjuice/client/sync_test.exs
@@ -196,7 +196,7 @@ defmodule Polyjuice.Client.SyncTest do
end
end
- defp handle_login(session_id, _env, {_, input}) do
+ defp handle_login(session_id, _env, _input) do
:mod_esi.deliver(
session_id,
'Content-Type: application/json\r\n\r\n{"user_id":"@alice:example.org","access_token":"an_access_token","device_id":"foo"}'
@@ -235,7 +235,7 @@ defmodule Polyjuice.Client.SyncTest do
port = :httpd.info(httpd_pid) |> Keyword.fetch!(:port)
- client =
+ {:ok, client_pid} =
Polyjuice.Client.start_link(
"http://127.0.0.1:#{port}/Elixir.Polyjuice.Client.SyncTest.Httpd",
access_token: "an_access_token",
@@ -246,6 +246,8 @@ defmodule Polyjuice.Client.SyncTest do
test: true
)
+ client = Polyjuice.Client.get_client(client_pid)
+
assert_receive({:polyjuice_client, :sync_connected})
assert_receive(
@@ -329,7 +331,7 @@ defmodule Polyjuice.Client.SyncTest do
1000
)
- Polyjuice.Client.stop(client)
+ Polyjuice.Client.API.stop(client)
:inets.stop(:httpd, httpd_pid)
after
@@ -362,7 +364,7 @@ defmodule Polyjuice.Client.SyncTest do
port = :httpd.info(httpd_pid) |> Keyword.fetch!(:port)
- client =
+ {:ok, client_pid} =
Polyjuice.Client.start_link(
"http://127.0.0.1:#{port}/Elixir.Polyjuice.Client.SyncTest.Httpd",
handler: self(),
@@ -371,6 +373,8 @@ defmodule Polyjuice.Client.SyncTest do
test: true
)
+ client = Polyjuice.Client.get_client(client_pid)
+
{:ok, _} = Polyjuice.Client.log_in_with_password(client, "@alice:example.org", "password")
assert_receive({:polyjuice_client, :sync_connected})
@@ -384,7 +388,7 @@ defmodule Polyjuice.Client.SyncTest do
|> Supervisor.which_children()
|> Enum.find(fn {id, _, _, _} -> id == Polyjuice.Client.Sync end) == nil
- Polyjuice.Client.stop(client)
+ Polyjuice.Client.API.stop(client)
:inets.stop(:httpd, httpd_pid)
after
@@ -417,7 +421,7 @@ defmodule Polyjuice.Client.SyncTest do
port = :httpd.info(httpd_pid) |> Keyword.fetch!(:port)
- client =
+ {:ok, client_pid} =
Polyjuice.Client.start_link(
"http://127.0.0.1:#{port}/Elixir.Polyjuice.ClientTest.Httpd.LoggedOut",
access_token: "an_access_token",
@@ -428,6 +432,8 @@ defmodule Polyjuice.Client.SyncTest do
test: true
)
+ client = Polyjuice.Client.get_client(client_pid)
+
assert_receive({:polyjuice_client, :logged_out, {false}})
# make sure the sync has time to stop
@@ -438,7 +444,7 @@ defmodule Polyjuice.Client.SyncTest do
|> Enum.find_value(fn {id, pid, _, _} -> if id == Polyjuice.Client.Sync, do: pid end) ==
:undefined
- Polyjuice.Client.stop(client)
+ Polyjuice.Client.API.stop(client)
:inets.stop(:httpd, httpd_pid)
after
@@ -471,7 +477,7 @@ defmodule Polyjuice.Client.SyncTest do
port = :httpd.info(httpd_pid) |> Keyword.fetch!(:port)
- client =
+ {:ok, client_pid} =
Polyjuice.Client.start_link(
"http://127.0.0.1:#{port}/Elixir.Polyjuice.ClientTest.Httpd.LoggedOut",
access_token: "an_access_token",
@@ -481,6 +487,8 @@ defmodule Polyjuice.Client.SyncTest do
test: true
)
+ client = Polyjuice.Client.get_client(client_pid)
+
assert_receive({:polyjuice_client, :logged_out, {false}})
# make sure the sync has time to stop
@@ -491,7 +499,7 @@ defmodule Polyjuice.Client.SyncTest do
|> Enum.find_value(fn {id, pid, _, _} -> if id == Polyjuice.Client.Sync, do: pid end) ==
:undefined
- Polyjuice.Client.stop(client)
+ Polyjuice.Client.API.stop(client)
:inets.stop(:httpd, httpd_pid)
after