diff options
author | Azul <azul@leap.se> | 2012-06-18 12:34:11 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-06-18 12:34:11 +0200 |
commit | 09a7a8c0fb28ff49fac64f282aa136f8a2c20dfe (patch) | |
tree | 09e0101fb5d02cf0db3648eae562a981aa422b17 /test/auth_test.rb |
initial commit - testing srp auth
* This is lacking a few steps. We confirm the secret is the same but no key is generated from it and it is transfered over the wire in clear.
* this was inspired by https://gist.github.com/790048
* seperated util, client, server and test code
Diffstat (limited to 'test/auth_test.rb')
-rw-r--r-- | test/auth_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/auth_test.rb b/test/auth_test.rb new file mode 100644 index 0000000..e6c4017 --- /dev/null +++ b/test/auth_test.rb @@ -0,0 +1,25 @@ +require File.expand_path(File.dirname(__FILE__) + '/test_helper') + +class AuthTest < Test::Unit::TestCase + + def setup + @username = 'user' + @password = 'opensasemi' + @client = SRP::Client.new(@username, @password) + @server = SRP::Server.new(@client.salt, @client.verifier) + end + + def test_successful_auth + assert @client.authenticate(@server, @username, @password) + end + + def test_wrong_password + assert !@client.authenticate(@server, @username, "password") + end + + def test_wrong_username + assert !@client.authenticate(@server, "username", @password) + end +end + + |