summaryrefslogtreecommitdiff
path: root/users/test/unit
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2012-09-27 22:39:08 +0200
committerAzul <azul@riseup.net>2012-09-27 22:39:08 +0200
commitebbfe3d77efddbe8f97fa82c171632ac4cfcf6da (patch)
treeb81b55476f4f7889af0e346ebf5dc95afc4a02af /users/test/unit
parent1208257bcc0e2a6648b68433a7b7e24791f92583 (diff)
added in leap web users - one repo to rule them all
Diffstat (limited to 'users/test/unit')
-rw-r--r--users/test/unit/.gitkeep0
-rw-r--r--users/test/unit/helpers/session_helper_test.rb4
-rw-r--r--users/test/unit/helpers/users_helper_test.rb4
-rw-r--r--users/test/unit/unauthorized_user_test.rb7
-rw-r--r--users/test/unit/user_test.rb40
5 files changed, 55 insertions, 0 deletions
diff --git a/users/test/unit/.gitkeep b/users/test/unit/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/users/test/unit/.gitkeep
diff --git a/users/test/unit/helpers/session_helper_test.rb b/users/test/unit/helpers/session_helper_test.rb
new file mode 100644
index 0000000..2824733
--- /dev/null
+++ b/users/test/unit/helpers/session_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class SessionHelperTest < ActionView::TestCase
+end
diff --git a/users/test/unit/helpers/users_helper_test.rb b/users/test/unit/helpers/users_helper_test.rb
new file mode 100644
index 0000000..96af37a
--- /dev/null
+++ b/users/test/unit/helpers/users_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class UsersHelperTest < ActionView::TestCase
+end
diff --git a/users/test/unit/unauthorized_user_test.rb b/users/test/unit/unauthorized_user_test.rb
new file mode 100644
index 0000000..5b96ae1
--- /dev/null
+++ b/users/test/unit/unauthorized_user_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class UnauthorizedUserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/users/test/unit/user_test.rb b/users/test/unit/user_test.rb
new file mode 100644
index 0000000..870d422
--- /dev/null
+++ b/users/test/unit/user_test.rb
@@ -0,0 +1,40 @@
+require 'test_helper'
+
+class UserTest < ActiveSupport::TestCase
+
+ include SRP::Util
+ test "test set of attributes should be valid" do
+ user = User.new(User.valid_attributes_hash)
+ assert user.valid?
+ end
+
+ test "find_by_param gets User by login" do
+ user = User.create!(User.valid_attributes_hash)
+ assert_equal user, User.find_by_param(user.login)
+ user.destroy
+ end
+
+ test "to_param gives user login" do
+ user = User.new(User.valid_attributes_hash)
+ assert_equal user.login, user.to_param
+ end
+
+ test "verifier returns number for the hex in password_verifier" do
+ user = User.new(User.valid_attributes_hash)
+ assert_equal user.password_verifier.hex, user.verifier
+ end
+
+ test "salt returns number for the hex in password_salt" do
+ user = User.new(User.valid_attributes_hash)
+ assert_equal user.password_salt.hex, user.salt
+ end
+
+ test "should include SRP::Authentication" do
+ client_rnd = bigrand(32).hex
+ user = User.new(User.valid_attributes_hash)
+ srp_session = user.initialize_auth(client_rnd)
+ assert srp_session.is_a? SRP::Authentication::Session
+ assert_equal client_rnd, srp_session.aa
+ end
+
+end