diff options
Diffstat (limited to 'test/functional/api/identities_controller_test.rb')
-rw-r--r-- | test/functional/api/identities_controller_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/api/identities_controller_test.rb b/test/functional/api/identities_controller_test.rb new file mode 100644 index 0000000..57345c8 --- /dev/null +++ b/test/functional/api/identities_controller_test.rb @@ -0,0 +1,24 @@ +require_relative '../../test_helper' + +class Api::IdentitiesControllerTest < ApiControllerTest + + test "api monitor can fetch identity" do + monitor_auth do + identity = FactoryGirl.create :identity + api_get :show, :id => identity.address, :format => 'json' + assert_response :success + assert_equal identity, assigns(:identity) + + api_get :show, :id => "blahblahblah", :format => 'json' + assert_response :not_found + end + end + + + test "anonymous cannot fetch identity" do + identity = FactoryGirl.create :identity + api_get :show, :id => identity.address, :format => 'json' + assert_response :forbidden + end + +end |