Add test. This might not work

This commit is contained in:
connor rigby 2018-01-30 10:04:32 -08:00
parent 6de2fae14d
commit cb10c96b52

View file

@ -1,6 +1,7 @@
defmodule Farmbot.Bootstrap.AuthorizationTest do
@moduledoc "Tests the default authorization implementation"
alias Farmbot.Bootstrap.Authorization, as: Auth
alias Farmbot.Bootstrap.AuthTask
use ExUnit.Case
@moduletag :farmbot_api
@ -37,4 +38,12 @@ defmodule Farmbot.Bootstrap.AuthorizationTest do
res = Auth.authorize("yolo@mtv.org", "123password", ctx.server)
assert match?({:error, _}, res)
end
test "internet off and back on refreshes token" do
old = Farmbot.System.ConfigStorage.get_config_value(:string, "authorization", "token")
send AuthTask, {Farmbot.System.Registry, {:network, :dns_up}}
Process.sleep(100)
new = Farmbot.System.ConfigStorage.get_config_value(:string, "authorization", "token")
assert old != new
end
end