TEST: command() refuses to run RPCs in :boot state

pull/1130/head
Rick Carlino 2020-01-31 13:53:46 -06:00
parent cd0a0a3a13
commit b5cad63a55
2 changed files with 16 additions and 1 deletions

View File

@ -6,6 +6,22 @@ defmodule FarmbotFirmware.CommandTest do
import ExUnit.CaptureLog
@subject FarmbotFirmware.Command
test "command() runs RPCs" do
arg = [transport: FarmbotFirmware.StubTransport]
{:ok, pid} = FarmbotFirmware.start_link(arg, [])
send(pid, :timeout)
{:error, message} = @subject.command(pid, {:a, {:b, :c}})
assert "Can't send command when in :boot state" == message
end
test "command() refuses to run RPCs in :boot state" do
arg = [transport: FarmbotFirmware.StubTransport]
{:ok, pid} = FarmbotFirmware.start_link(arg, [])
send(pid, :timeout)
{:error, message} = @subject.command(pid, {:a, {:b, :c}})
assert "Can't send command when in :boot state" == message
end
test "enable_debug_logs" do
Application.put_env(:farmbot_firmware, @subject, foo: :bar, debug_log: false)

View File

@ -3,7 +3,6 @@ defmodule FarmbotFirmwareTest do
doctest FarmbotFirmware
def try_command(pid, cmd) do
# @subject.command(pid, cmd)
GenServer.call(pid, cmd, :infinity)
end