Make test moar bettar. nosleep
This commit is contained in:
parent
cb10c96b52
commit
fe0a480e0a
|
@ -44,6 +44,7 @@ defmodule Farmbot.Bootstrap.AuthTask do
|
|||
if get_config_value(:bool, "settings", "auto_sync") do
|
||||
Farmbot.Repo.flip()
|
||||
end
|
||||
Farmbot.System.Registry.dispatch :authorization, :new_token
|
||||
restart_transports()
|
||||
refresh_timer(self())
|
||||
{:error, err} ->
|
||||
|
|
|
@ -40,9 +40,12 @@ defmodule Farmbot.Bootstrap.AuthorizationTest do
|
|||
end
|
||||
|
||||
test "internet off and back on refreshes token" do
|
||||
Farmbot.System.Registry.subscribe(self())
|
||||
old = Farmbot.System.ConfigStorage.get_config_value(:string, "authorization", "token")
|
||||
send AuthTask, {Farmbot.System.Registry, {:network, :dns_up}}
|
||||
Process.sleep(100)
|
||||
|
||||
assert_receive {Farmbot.System.Registry, {:authorization, :new_token}}
|
||||
|
||||
new = Farmbot.System.ConfigStorage.get_config_value(:string, "authorization", "token")
|
||||
assert old != new
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue