Skip to content

Instantly share code, notes, and snippets.

@blackode
Created February 14, 2017 10:20
Show Gist options
  • Save blackode/3de71e46540bf1dee0702befcf52e67d to your computer and use it in GitHub Desktop.
Save blackode/3de71e46540bf1dee0702befcf52e67d to your computer and use it in GitHub Desktop.
defmodule PasswordLockTest do
use ExUnit.Case
doctest PasswordLock
setup do
{:ok,server_pid} = PasswordLock.start_link("foo")
{:ok,server: server_pid}
end
test "unlock success test", %{server: pid} do
assert :ok == PasswordLock.unlock(pid,"foo")
end
test "unlock failure test", %{server: pid} do
assert {:error,"wrongpassword"} == PasswordLock.unlock(pid,"bar")
end
test "reset failure error" ,%{server: pid} do
assert {:error,"wrongpassword"} == PasswordLock.reset(pid,{"hello","bar"})
end
test "reset success test" ,%{server: pid} do
assert :ok == PasswordLock.reset(pid,{"foo","bar"})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment