summaryrefslogtreecommitdiff
path: root/test/controllers/users_controller_test.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-24 13:52:56 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-24 13:52:56 +0200
commitfefec929c59c72dc93e4be30e8f23cd8c5258b0a (patch)
treee35d2e050a9052384e52a5ccb623d8dd193c2370 /test/controllers/users_controller_test.rb
parentcd36a46bbb5679ded1653f65bf4e8a74ae55100c (diff)
Add self-service TOTP enrollment UI and witnessed admin reset
Diffstat (limited to 'test/controllers/users_controller_test.rb')
-rw-r--r--test/controllers/users_controller_test.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb
index 58f8a86b..946b5414 100644
--- a/test/controllers/users_controller_test.rb
+++ b/test/controllers/users_controller_test.rb
@@ -182,5 +182,17 @@ class UsersControllerTest < ActionController::TestCase
182 assert_equal false, user.is_admin? 182 assert_equal false, user.is_admin?
183 end 183 end
184 184
185 185 test "reset_otp is admin-only and witnessed" do
186 user = users(:quentin)
187 user.update!(:otp_secret => ROTP::Base32.random)
188
189 login_as :quentin
190 put :reset_otp, params: { :id => user.id }
191 assert user.reload.otp_enrolled?, "non-admin must be refused"
192
193 login_as :aaron
194 put :reset_otp, params: { :id => user.id }
195 assert_not user.reload.otp_enrolled?
196 assert_equal "otp_reset", NodeAction.last.action
197 end
186end 198end