summaryrefslogtreecommitdiff
path: root/test/auth_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/auth_test.rb')
-rw-r--r--test/auth_test.rb25
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
+
+