diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/api/update_account_test.rb | 6 | ||||
-rw-r--r-- | test/integration/regression/key_discovery_test.rb | 23 | ||||
-rw-r--r-- | test/integration/regression/provider_info_test.rb | 20 | ||||
-rw-r--r-- | test/integration/routes/no_route_test.rb | 17 |
4 files changed, 66 insertions, 0 deletions
diff --git a/test/integration/api/update_account_test.rb b/test/integration/api/update_account_test.rb index 1492006..108f05d 100644 --- a/test/integration/api/update_account_test.rb +++ b/test/integration/api/update_account_test.rb @@ -28,6 +28,12 @@ class UpdateAccountTest < SrpTest assert server_auth["M2"] end + test "update recovery code via api" do + authenticate + update_user recovery_code_verifier: "123", recovery_code_salt: "456" + assert last_response.successful? + end + test "change login with password_verifier" do authenticate new_login = 'zaph' diff --git a/test/integration/regression/key_discovery_test.rb b/test/integration/regression/key_discovery_test.rb new file mode 100644 index 0000000..2a38a78 --- /dev/null +++ b/test/integration/regression/key_discovery_test.rb @@ -0,0 +1,23 @@ +require 'test_helper' + +# This is not really a browser test - key discovery is used from bitmask. +# However we need to make sure to test the full rack stack to replicate +# exception handling. +class KeyDiscoveryTest < RackStackTest + include Capybara::DSL + + setup do + # make sure we test the whole stack... + Capybara.current_driver = Capybara.javascript_driver + end + + teardown do + # Revert Capybara.current_driver to Capybara.default_driver + Capybara.use_default_driver + end + + def test_404_on_non_existing_user + visit '/key/asjkholifweatg' + assert_equal 404, status_code + end +end diff --git a/test/integration/regression/provider_info_test.rb b/test/integration/regression/provider_info_test.rb new file mode 100644 index 0000000..2aaf6f6 --- /dev/null +++ b/test/integration/regression/provider_info_test.rb @@ -0,0 +1,20 @@ +require 'test_helper' + +class ProviderInfoTest < BrowserIntegrationTest + + def test_404_on_missing_page + visit '/about' + assert_equal 404, status_code + end + + def test_404_on_missing_language_page + visit '/de/about' + assert_equal 404, status_code + end + + def test_404_en_fallback + visit '/de/bye' + assert_equal 200, status_code + end + +end diff --git a/test/integration/routes/no_route_test.rb b/test/integration/routes/no_route_test.rb new file mode 100644 index 0000000..a570f85 --- /dev/null +++ b/test/integration/routes/no_route_test.rb @@ -0,0 +1,17 @@ +require 'test_helper' + +class NoRouteTest < ActionDispatch::IntegrationTest + + def test_path_with_dot + assert_no_route '.viminfo' + end + + def assert_no_route(path, options = {}) + options[:method] ||= :get + path = "/#{path}" unless path.first == "/" + params = @routes.recognize_path(path, method: :get) + flunk "Expected no route to '#{path}' but found: #{params.inspect}" + rescue ActionController::RoutingError + pass + end +end |