summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api/srp_test.rb2
-rw-r--r--test/integration/api/update_account_test.rb8
-rw-r--r--test/integration/browser/account_livecycle_test.rb15
3 files changed, 22 insertions, 3 deletions
diff --git a/test/integration/api/srp_test.rb b/test/integration/api/srp_test.rb
index b9605f9..ef5d9b8 100644
--- a/test/integration/api/srp_test.rb
+++ b/test/integration/api/srp_test.rb
@@ -46,7 +46,7 @@ class SrpTest < RackTest
@password = password
end
- def update_user(params)
+ def update_user(params = {})
put api_url("users/#{@user.id}.json"),
user_params(params),
auth_headers
diff --git a/test/integration/api/update_account_test.rb b/test/integration/api/update_account_test.rb
index f083dbc..dd28b06 100644
--- a/test/integration/api/update_account_test.rb
+++ b/test/integration/api/update_account_test.rb
@@ -19,6 +19,14 @@ class UpdateAccountTest < SrpTest
assert_login_required
end
+ test "empty request" do
+ authenticate
+ update_user
+ refute last_response.successful?
+ assert_equal 400, last_response.status
+ assert_equal '', last_response.body
+ end
+
test "update password via api" do
authenticate
update_user password: "No! Verify me instead."
diff --git a/test/integration/browser/account_livecycle_test.rb b/test/integration/browser/account_livecycle_test.rb
index cfab444..68775d3 100644
--- a/test/integration/browser/account_livecycle_test.rb
+++ b/test/integration/browser/account_livecycle_test.rb
@@ -63,6 +63,16 @@ class AccountLivecycleTest < BrowserIntegrationTest
assert_invalid_login(page)
end
+ test "failed login with locale" do
+ page.driver.add_header 'Accept-Language', 'de'
+ visit '/'
+ click_on 'Anmelden'
+ fill_in 'Nutzername', with: 'username'
+ fill_in 'Password', with: 'falsches password'
+ click_on 'Session erstellen'
+ assert_invalid_login(page, locale: :de)
+ end
+
test "account destruction" do
username, password = submit_signup
@@ -115,9 +125,10 @@ class AccountLivecycleTest < BrowserIntegrationTest
click_on 'Log In'
end
- def assert_invalid_login(page)
+ def assert_invalid_login(page, locale: nil)
assert page.has_selector? '.btn-primary.disabled'
- assert page.has_content? sanitize(I18n.t(:invalid_user_pass), tags: [])
+ message = I18n.t :invalid_user_pass, locale: locale
+ assert page.has_content? sanitize(message, tags: [])
assert page.has_no_selector? '.btn-primary.disabled'
end