summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/auth_test.rb25
-rw-r--r--test/test_helper.rb3
2 files changed, 28 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
+
+
diff --git a/test/test_helper.rb b/test/test_helper.rb
new file mode 100644
index 0000000..68d3acf
--- /dev/null
+++ b/test/test_helper.rb
@@ -0,0 +1,3 @@
+require "rubygems"
+require 'test/unit'
+require File.expand_path(File.dirname(__FILE__) + '/../lib/srp.rb')