summaryrefslogtreecommitdiff
path: root/test/functional/v1/identities_controller_test.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-03-28 15:55:19 -0700
committerelijah <elijah@riseup.net>2016-03-28 16:03:54 -0700
commite072ac2fa8bc93ed782df1ff95130f4794f9640f (patch)
tree986c2cfd607af3f6c0e9c34f62d82de07ff0f3f6 /test/functional/v1/identities_controller_test.rb
parent67b5aa4198e0f6ab2cd29767aedcb4bf5b5dc4d9 (diff)
api: added allow ability to limit what IPs can access api using a static configured auth token.
Diffstat (limited to 'test/functional/v1/identities_controller_test.rb')
-rw-r--r--test/functional/v1/identities_controller_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/v1/identities_controller_test.rb b/test/functional/v1/identities_controller_test.rb
new file mode 100644
index 0000000..3e88402
--- /dev/null
+++ b/test/functional/v1/identities_controller_test.rb
@@ -0,0 +1,20 @@
+require_relative '../../test_helper'
+
+class V1::IdentitiesControllerTest < ActionController::TestCase
+
+ test "api monitor can fetch identity" do
+ monitor_auth do
+ identity = FactoryGirl.create :identity
+ get :show, :id => identity.address, :format => 'json'
+ assert_response :success
+ assert_equal identity, assigns(:identity)
+ end
+ end
+
+ test "anonymous cannot fetch identity" do
+ identity = FactoryGirl.create :identity
+ get :show, :id => identity.address, :format => 'json'
+ assert_response :forbidden
+ end
+
+end