Sha256: ab74b112c1e0f0dfbb7ec6c65f65c5ff75ed416f25bf453d86dfd3cd508c3f14

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

require_relative "helper"

class TestBase < Test::Unit::TestCase
  def test_base
    otp = OTP::Base.new
    otp.new_secret(20)
    assert_equal(32, otp.secret.length)
    otp.new_secret(40)
    assert_equal(64, otp.secret.length)
  end

  def test_methods_expected_to_be_override
    base = OTP::Base.new
    totp = OTP::TOTP.new

    [
      [:moving_factor, ],
      [:type_specific_uri_params, ],
      [:extract_type_specific_uri_params, {}],
    ].each do |m, *args|
      assert_raise(NotImplementedError){ base.send(m, *args) }
      assert_nothing_raised{ totp.send(m, *args) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
otp-0.0.9 test/test_base.rb