Make test moar bettar. nosleep

pull/435/head
connor rigby 2018-01-30 10:19:24 -08:00
parent cb10c96b52
commit fe0a480e0a
2 changed files with 5 additions and 1 deletions

View File

@ -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} ->

View File

@ -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