diff options
author | elijah <elijah@riseup.net> | 2014-12-17 16:22:29 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-12-17 16:22:29 -0800 |
commit | b49fc6c4a864c6e42a4fd4deae25c0ab2eb564ea (patch) | |
tree | 896ba1487d395cc15e14c8176846019a05de69cd /tests | |
parent | 25569d4598d86c6b992c35d8bbede8510483cdc6 (diff) |
tests: don't run soledad test if there are no soledad nodes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/helpers/bonafide_helper.rb | 2 | ||||
-rw-r--r-- | tests/white-box/webapp.rb | 24 |
2 files changed, 16 insertions, 10 deletions
diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb index faf8c1f4..9b26eaaf 100644 --- a/tests/helpers/bonafide_helper.rb +++ b/tests/helpers/bonafide_helper.rb @@ -34,7 +34,7 @@ class LeapTest url = api_url("/1/users.json") assert_post(url, user.to_params) do |body| assert response = JSON.parse(body), 'response should be JSON' - assert response['ok'], 'creating a user should be successful' + assert response['ok'], "Creating a user should be successful, got #{response.inspect} instead." end user.ok = true return user diff --git a/tests/white-box/webapp.rb b/tests/white-box/webapp.rb index d5d41833..9f104899 100644 --- a/tests/white-box/webapp.rb +++ b/tests/white-box/webapp.rb @@ -50,12 +50,14 @@ class Webapp < LeapTest soledad_config = property('definition_files.soledad_service') if soledad_config && !soledad_config.empty? soledad_server = pick_soledad_server(soledad_config) - assert_tmp_user do |user| - assert_user_db_exists(user) - command = File.expand_path "../../helpers/soledad_sync.py", __FILE__ - soledad_url = "https://#{soledad_server}/user-#{user.id}" - assert_run "#{command} #{user.id} #{user.session_token} #{soledad_url}" - pass + if soledad_server + assert_tmp_user do |user| + assert_user_db_exists(user) + command = File.expand_path "../../helpers/soledad_sync.py", __FILE__ + soledad_url = "https://#{soledad_server}/user-#{user.id}" + assert_run "#{command} #{user.id} #{user.session_token} #{soledad_url}" + pass + end end else skip 'No soledad service configuration' @@ -78,9 +80,13 @@ class Webapp < LeapTest def pick_soledad_server(soledad_config_json_str) soledad_config = JSON.parse(soledad_config_json_str) host_name = soledad_config['hosts'].keys.shuffle.first - hostname = soledad_config['hosts'][host_name]['hostname'] - port = soledad_config['hosts'][host_name]['port'] - return "#{hostname}:#{port}" + if host_name + hostname = soledad_config['hosts'][host_name]['hostname'] + port = soledad_config['hosts'][host_name]['port'] + return "#{hostname}:#{port}" + else + return nil + end end # |