summaryrefslogtreecommitdiff
path: root/users/test/integration/api/account_flow_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-06 11:51:10 +0100
committerAzul <azul@leap.se>2012-11-06 11:51:10 +0100
commitda2804c8f8a800851fa1863f579e2b8e9a57b4cc (patch)
treeaa3dc8b9eb1741870e7f98e9c1c71a626c2979da /users/test/integration/api/account_flow_test.rb
parentef90c45998b33ba8606c3786875e21496ace4686 (diff)
first steps towards warden srp testing
Diffstat (limited to 'users/test/integration/api/account_flow_test.rb')
-rw-r--r--users/test/integration/api/account_flow_test.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb
index dc475b5..4dcca24 100644
--- a/users/test/integration/api/account_flow_test.rb
+++ b/users/test/integration/api/account_flow_test.rb
@@ -1,7 +1,16 @@
require 'test_helper'
-class AccountFlowTest < ActionDispatch::IntegrationTest
+CONFIG_RU = (Rails.root + 'config.ru').to_s
+OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first
+
+class AccountFlowTest < ActiveSupport::TestCase
+ include Rack::Test::Methods
include Warden::Test::Helpers
+ include LeapWebCore::AssertResponses
+
+ def app
+ OUTER_APP
+ end
def teardown
Warden.test_reset!
@@ -9,9 +18,9 @@ class AccountFlowTest < ActionDispatch::IntegrationTest
# this test wraps the api and implements the interface the ruby-srp client.
def handshake(login, aa)
- post "sessions", :login => login, 'A' => aa.to_s(16), :format => :json
- assert_response :success
- response = JSON.parse(@response.body)
+ post "/sessions.json", :login => login, 'A' => aa.to_s(16), :format => :json
+ assert last_response.successful?
+ response = JSON.parse(last_response.body)
if response['errors']
raise RECORD_NOT_FOUND.new(response['errors'])
else
@@ -20,9 +29,10 @@ class AccountFlowTest < ActionDispatch::IntegrationTest
end
def validate(m)
- put "sessions/" + @login, :client_auth => m.to_s(16), :format => :json
- assert_response :success
- return JSON.parse(@response.body)
+ debugger
+ put "/sessions/" + @login + '.json', :client_auth => m.to_s(16), :format => :json
+ assert last_response.successful?
+ return JSON.parse(last_response.body)
end
def setup
@@ -45,7 +55,7 @@ class AccountFlowTest < ActionDispatch::IntegrationTest
test "signup response" do
assert_json_response :login => @login, :ok => true
- assert_response :success
+ assert last_response.successful?
end
test "signup and login with srp via api" do