Created
February 14, 2017 10:20
-
-
Save blackode/3de71e46540bf1dee0702befcf52e67d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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