{:plug_cowboy, "~> 2.1"},
{:states_language, "~> 0.2"},
{:wampex, git: "https://gitlab.com/entropealabs/wampex.git", tag: "7d656d9748cb0e4d08c625d87e315839afecb4b2"},
+ # {:wampex_client, path: "../wampex_client", only: [:dev, :test]}
{:wampex_client,
git: "https://gitlab.com/entropealabs/wampex_client.git",
- tag: "7896d51d7493fd3477de2a226d7d97f2c3098736",
+ tag: "a6478667525bbc048215a94ec237a6b45f9009f1",
only: [:dev, :test]}
]
end
@realm_uri "admin"
@auth %Authentication{authid: @authid, authmethods: ["wampcra"], secret: @auth_password}
@realm %Realm{name: @realm_uri, authentication: @auth}
- @roles [Callee, Caller, Publisher, Subscriber]
+ @roles [Caller, Callee, Publisher, Subscriber]
@device "as987d9a8sd79a87ds"
@session %Session{url: @url, realm: @realm, roles: @roles}
setup_all do
]
end
+ test "role not supported" do
+ callee_name = TestCalleeAbortRegistration
+ Client.start_link(name: callee_name, session: @session, reconnect: false)
+ TestCallee.start_link(self(), callee_name, @device)
+
+ name = TestCallerFail
+ [_ | t] = @session.roles
+ sess = %Session{@session | roles: t}
+ {:ok, pid} = Client.start_link(name: name, session: sess, reconnect: false)
+
+ try do
+ Client.call(name, %Call{procedure: "com.actuator.#{@device}.light"})
+ catch
+ :exit, er ->
+ assert {:normal, _} = er
+ end
+ end
+
@tag :client
test "callee registration" do
name = TestCalleeRegistration
@tag :abort
test "abort" do
- Process.flag(:trap_exit, true)
callee_name = TestAbort
{:ok, pid} = Client.start_link(name: callee_name, session: @session, reconnect: false)
- Client.cast(callee_name, Peer.hello(%Hello{realm: "test", roles: [Callee]}))
- assert_receive {:EXIT, ^pid, :shutdown}, 1000
+
+ try do
+ Client.cast(callee_name, Peer.hello(%Hello{realm: "test", roles: [Callee]}))
+ catch
+ :exit, er ->
+ assert {:normal, _} = er
+ end
end
@tag :client