initial commit - testing srp auth
[ruby_srp.git] / test / auth_test.rb
1 require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
3 class AuthTest < Test::Unit::TestCase
4
5   def setup
6     @username = 'user'
7     @password = 'opensasemi'
8     @client = SRP::Client.new(@username, @password)
9     @server = SRP::Server.new(@client.salt, @client.verifier)
10   end
11
12   def test_successful_auth
13     assert @client.authenticate(@server, @username, @password)
14   end
15
16   def test_wrong_password
17     assert !@client.authenticate(@server, @username, "password")
18   end
19
20   def test_wrong_username
21     assert !@client.authenticate(@server, "username", @password)
22   end
23 end
24
25