summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2013-01-17 22:39:50 -0800
committerazul <azul@riseup.net>2013-01-17 22:39:50 -0800
commitc172c91d8041fbf85ec6b0054c30f31d41a1008b (patch)
treea6657e3f93ce6b529d34004b76919daad6ce6fd3 /users
parent6347fdbe0d932e78dfa8259bf81355edb19508e9 (diff)
parent1cf4cc5c8d571b571367a08f5e201be868289ed1 (diff)
Merge pull request #16 from leapcode/feature/fixing-routes-with-api
Fixing routes with api
Diffstat (limited to 'users')
-rw-r--r--users/config/routes.rb10
-rw-r--r--users/test/integration/api/account_flow_test.rb11
-rwxr-xr-xusers/test/integration/api/python/flow_with_srp.py2
3 files changed, 16 insertions, 7 deletions
diff --git a/users/config/routes.rb b/users/config/routes.rb
index 8985502..0c2d8d9 100644
--- a/users/config/routes.rb
+++ b/users/config/routes.rb
@@ -1,8 +1,12 @@
Rails.application.routes.draw do
- scope "/1", :module => "V1", defaults: {format: 'json'} do
- resources :sessions, :only => [:new, :create, :update, :destroy]
- resources :users, :only => [:create]
+ constraints :subdomain => "api" do
+ namespace "api", { module: "V1",
+ path: "/1/",
+ defaults: {format: 'json'} } do
+ resources :sessions, :only => [:new, :create, :update, :destroy]
+ resources :users, :only => [:create]
+ end
end
get "login" => "sessions#new", :as => "login"
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb
index b9e2a4e..268fb5e 100644
--- a/users/test/integration/api/account_flow_test.rb
+++ b/users/test/integration/api/account_flow_test.rb
@@ -22,7 +22,7 @@ class AccountFlowTest < ActiveSupport::TestCase
:password_verifier => @srp.verifier.to_s(16),
:password_salt => @srp.salt.to_s(16)
}
- post '/1/users.json', :user => @user_params
+ post 'http://api.lvh.me:3000/1/users.json', :user => @user_params
@user = User.find_by_param(@login)
end
@@ -33,7 +33,10 @@ class AccountFlowTest < ActiveSupport::TestCase
# this test wraps the api and implements the interface the ruby-srp client.
def handshake(login, aa)
- post "/1/sessions.json", :login => login, 'A' => aa.to_s(16), :format => :json
+ post "http://api.lvh.me:3000/1/sessions.json",
+ :login => login,
+ 'A' => aa.to_s(16),
+ :format => :json
response = JSON.parse(last_response.body)
if response['errors']
raise RECORD_NOT_FOUND.new(response['errors'])
@@ -43,7 +46,9 @@ class AccountFlowTest < ActiveSupport::TestCase
end
def validate(m)
- put "/1/sessions/" + @login + '.json', :client_auth => m.to_s(16), :format => :json
+ put "http://api.lvh.me:3000/1/sessions/" + @login + '.json',
+ :client_auth => m.to_s(16),
+ :format => :json
return JSON.parse(last_response.body)
end
diff --git a/users/test/integration/api/python/flow_with_srp.py b/users/test/integration/api/python/flow_with_srp.py
index f28aeda..df83dfb 100755
--- a/users/test/integration/api/python/flow_with_srp.py
+++ b/users/test/integration/api/python/flow_with_srp.py
@@ -16,7 +16,7 @@ def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
# using globals for a start
-server = 'http://localhost:3000/1'
+server = 'http://api.lvh.me:3000/1'
login = id_generator()
password = id_generator() + id_generator()