Sha256: 9fa1d270c655fcb6e2420c77eccc6c2a7bc9ad4e692444834558254a9c367d5c

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

require 'helper'

class PwnedTest < Test::Unit::TestCase

  def test_my_email_is_found
    assert_not_nil HaveIBeenPwned.pwned_account('john@gmail.com') # just a very generic email that does fail
  end

  def test_my_email_is_not_found
    assert_nil HaveIBeenPwned.pwned_account('major.monkey.ha.not.been.hacked@gmail.com')
  end

  def test_bad_api_key_gives_error
    assert_raise("UncaughtThrowError") {
      assert_equal false, HaveIBeenPwned.pwned_account('major.monkey.ha.not.been.hacked@gmail.com', 'not_a_valid_api_key')
    }    
  end

  def test_no_password_at_all_raises
    assert_raise("ArgumentError") {
      HaveIBeenPwned.pwned
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
have-i-been-pwned-1.1.0 test/test_have_i_been_pwned_account.rb