From 60052d15ca02b1c40ed265bed6515880d2851b8f Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 10 Jul 2014 12:13:30 +0200 Subject: clean up and simplify error responses and test code --- test/integration/api/cert_test.rb | 2 +- test/integration/api/login_test.rb | 2 +- test/integration/api/smtp_cert_test.rb | 2 +- test/integration/api/update_account_test.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'test/integration') diff --git a/test/integration/api/cert_test.rb b/test/integration/api/cert_test.rb index 74d439a..118fb9f 100644 --- a/test/integration/api/cert_test.rb +++ b/test/integration/api/cert_test.rb @@ -14,7 +14,7 @@ class CertTest < ApiIntegrationTest test "fetching certs requires login by default" do get '/1/cert', {}, RACK_ENV - assert_json_response error: I18n.t(:not_authorized) + assert_login_required end test "retrieve anonymous eip cert" do diff --git a/test/integration/api/login_test.rb b/test/integration/api/login_test.rb index 92d153f..f37639e 100644 --- a/test/integration/api/login_test.rb +++ b/test/integration/api/login_test.rb @@ -45,6 +45,6 @@ class LoginTest < SrpTest test "logout requires token" do authenticate logout(nil, {}) - assert_equal 422, last_response.status + assert_login_required end end diff --git a/test/integration/api/smtp_cert_test.rb b/test/integration/api/smtp_cert_test.rb index 7697e44..aee52cf 100644 --- a/test/integration/api/smtp_cert_test.rb +++ b/test/integration/api/smtp_cert_test.rb @@ -48,7 +48,7 @@ class SmtpCertTest < ApiIntegrationTest test "no anonymous smtp certs" do with_config allow_anonymous_certs: true do post '/1/smtp_cert', {}, RACK_ENV - assert_json_response error: I18n.t(:not_authorized) + assert_login_required end end end diff --git a/test/integration/api/update_account_test.rb b/test/integration/api/update_account_test.rb index 63429e7..16bbb8c 100644 --- a/test/integration/api/update_account_test.rb +++ b/test/integration/api/update_account_test.rb @@ -16,7 +16,7 @@ class UpdateAccountTest < SrpTest authenticate put "http://api.lvh.me:3000/1/users/" + @user.id + '.json', user_params(password: "No! Verify me instead.") - assert_access_denied + assert_login_required end test "update password via api" do -- cgit v1.2.3 From e8a3df62d14c8dd775811f4af885cf7e76d5d3f6 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 17 Jul 2014 11:18:57 +0200 Subject: clean up error assertions in tests We're not testing the redirects anymore. But the error messages should be pretty clear already. We can start testing redirects again once we redirect to different places for different actions. --- test/integration/api/smtp_cert_test.rb | 2 +- test/integration/api/srp_test.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'test/integration') diff --git a/test/integration/api/smtp_cert_test.rb b/test/integration/api/smtp_cert_test.rb index aee52cf..b1bfd43 100644 --- a/test/integration/api/smtp_cert_test.rb +++ b/test/integration/api/smtp_cert_test.rb @@ -42,7 +42,7 @@ class SmtpCertTest < ApiIntegrationTest test "fetching smtp certs requires email account" do login post '/1/smtp_cert', {}, RACK_ENV - assert_json_response error: I18n.t(:not_authorized) + assert_access_denied end test "no anonymous smtp certs" do diff --git a/test/integration/api/srp_test.rb b/test/integration/api/srp_test.rb index 26adc8c..946450e 100644 --- a/test/integration/api/srp_test.rb +++ b/test/integration/api/srp_test.rb @@ -1,5 +1,4 @@ class SrpTest < RackTest - include AssertResponses teardown do if @user -- cgit v1.2.3