Skip to content

Instantly share code, notes, and snippets.

Avatar

Amos King adkron

View GitHub Profile
View box.ex
defmodule Zipato.Box do
@moduledoc """
Build Zipato box commands
"""
alias Zipato.Sessions.{Master}
defstruct [session: Master, serial: nil, command: nil]
def list, do: %__MODULE__{command: :list}
def register(serial), do: %__MODULE__{command: :register, serial: serial}
View if_supervisor.ex
defmodule Nerves.Network.IFSupervisor do
use Supervisor
@moduledoc false
def start_link(options \\ []) do
Supervisor.start_link(__MODULE__, [], options)
end
def init([]) do
View supervisor.ex
defmodule Zipato.Sessions.Supervisor do
@moduledoc """
Supervisor for all sessions
"""
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, :ok, name: __MODULE__)
end
View server_test.exs
defmodule Zipato.Sessions.Server.Test do
use ExUnit.Case, async: true
@subject Zipato.Sessions.Server
@creds Application.get_env(:zipato, :credentials)
alias Zipato.{TestHelper, Request}
alias HTTPoison.{Response}
defmodule TestImpl do
use GenServer
View zipato.ex
defmodule Zipato do
@moduledoc """
Entry point for inteacting with the Zipato API
"""
alias Zipato.{Authentication, Transformer, Request}
@network Application.get_env(:zipato, :network)
@credentials Application.get_env(:zipato, :credentials)
@type serial :: String.t
View mix.exs
defmodule Smartrentcloud.Mixfile do
use Mix.Project
alias Mix.Shell.{IO}
def project do
[apps_path: "apps",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
aliases: aliases(),
preferred_cli_env: [pipeline: :test],
View controller.ex
defmodule Zwave.Controller do
@moduledoc """
Handles low level Zwave control
"""
alias Zwave.{
ControllerLocator,
Configuration,
Status,
}
View procedure_test.exs
defmodule Zwave.Inclusion.Process.Test do
use ExUnit.Case, async: true
alias Zwave.Inclusion.{Command, Response}
use Zwave.Status
@subject Zwave.Inclusion.Procedure
@node_timeout_in_ms 60 * 1000
setup do
Zwave.Registry.subscribe(:sent)
:ok
View messenger_test.exs
defmodule Zave.Commander.Messenger.Test do
use ExUnit.Case, async: true
@subject Zwave.Commander.Messenger
defmodule TestCommandModule do
defstruct [:initiator, :message]
def initialize(initiator) do
%__MODULE__{initiator: initiator}
end
@adkron
adkron / notes.md
Last active May 16, 2017
working on nerves UART OS X tests
View notes.md
  brew install socat
  socat -d -d pty,raw,echo=0 pty,raw,echo=0

When running socat I get an output with two serial ports. I put the two serial ports into NERVES_UART_PORT1 and NERVES_UART_PORT2 Running this gets all but 6 tests to pass.

No environment vars - 27 failures