summaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-04 15:40:54 +0200
committerAzul <azul@leap.se>2014-07-05 10:21:07 +0200
commit87e9ccbcdf4f99dd898b0715750092a27fff7e94 (patch)
tree9e49a287c6e95d92323253d899afa367a6f1e14e /test/functional
parent24d108e15c38ca572d5339a39cb110d9067c0b3d (diff)
Enable unblocking handles in identities tab
There's an identities tab now for admins that will allow unblocking blocked handles. It should be easy to expand for aliases and forwards and other types of actions such as editing.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/identities_controller_test.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/functional/identities_controller_test.rb b/test/functional/identities_controller_test.rb
new file mode 100644
index 0000000..fcdeaa2
--- /dev/null
+++ b/test/functional/identities_controller_test.rb
@@ -0,0 +1,42 @@
+require 'test_helper'
+
+class IdentitiesControllerTest < ActionController::TestCase
+
+ test "admin can list active and blocked ids" do
+ login :is_admin? => true
+ get :index
+ assert_response :success
+ assert ids = assigns(:identities)
+ end
+
+ test "non-admin can't list usernames" do
+ login
+ get :index
+ assert_access_denied
+ end
+
+ test "requires login" do
+ get :index
+ assert_login_required
+ end
+
+ test "admin can unblock username" do
+ # an identity without user_id and destination is a blocked handle
+ identity = FactoryGirl.create :identity
+ login :is_admin? => true
+ delete :destroy, id: identity.id
+ assert_response :redirect
+ assert_nil Identity.find(identity.id)
+ end
+
+ test "admin cannot remove main identity" do
+ user = FactoryGirl.create :user
+ identity = FactoryGirl.create :identity,
+ Identity.attributes_from_user(user)
+ login :is_admin? => true
+ delete :destroy, id: identity.id
+ assert_response :redirect
+ assert_equal identity, Identity.find(identity.id)
+ end
+
+end