summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorThais Siqueira <thais.siqueira@gmail.com>2017-03-10 12:02:56 -0300
committerThais Siqueira <thais.siqueira@gmail.com>2017-03-10 12:02:56 -0300
commit19714d01e28ca9ba37564fe0ad48d81c665806dd (patch)
tree618476e33e96fe4528b8e870f51d079ae0e43e76 /test/unit
parent417818997fca057635793cdf60a3e1bfa6716e35 (diff)
Validates recovery code as hexadecimal data.
Related with https://github.com/pixelated/pixelated-user-agent/issues/924 With @aarni
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/user_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 02e94df..e181765 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -28,6 +28,16 @@ class UserTest < ActiveSupport::TestCase
assert !@user.valid?
end
+ test "validates hex for recovery_code_verifier" do
+ @user.recovery_code_verifier = "1234567abcdef"
+ assert @user.valid?
+ end
+
+ test "validates recovery_code_verifier with non hex chars" do
+ @user.recovery_code_verifier = "gkpq"
+ assert !@user.valid?
+ end
+
test "test require alphanumerical for login" do
@user.login = "qw#r"
assert !@user.valid?