From b1e50fc76ddece9944ae253da9bacd485ffea84b Mon Sep 17 00:00:00 2001 From: varac Date: Tue, 6 Oct 2015 13:23:56 +0200 Subject: [feat] Remove tapicero from more places Remove from: - platform white-box tests (couchdb user ACLs, tapicero daemon test) - provider_base/ dir that handles the compilation of the hiera config file - Resolves: #7501 --- tests/white-box/couchdb.rb | 3 +-- tests/white-box/webapp.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/white-box/couchdb.rb b/tests/white-box/couchdb.rb index 5ee12ff3..edb28eac 100644 --- a/tests/white-box/couchdb.rb +++ b/tests/white-box/couchdb.rb @@ -9,7 +9,6 @@ class CouchDB < LeapTest end def test_00_Are_daemons_running? - assert_running '^tapicero', :single => true if multimaster? assert_running 'bin/beam' assert_running 'bin/epmd' @@ -70,7 +69,7 @@ class CouchDB < LeapTest end def test_04_Do_ACL_users_exist? - acl_users = ['_design/_auth', 'leap_mx', 'nickserver', 'soledad', 'tapicero', 'webapp', 'replication'] + acl_users = ['_design/_auth', 'leap_mx', 'nickserver', 'soledad', 'webapp', 'replication'] url = couchdb_backend_url("/_users/_all_docs", :username => 'admin') assert_get(url) do |body| response = JSON.parse(body) diff --git a/tests/white-box/webapp.rb b/tests/white-box/webapp.rb index 9956eb35..8be6bde2 100644 --- a/tests/white-box/webapp.rb +++ b/tests/white-box/webapp.rb @@ -95,7 +95,7 @@ class Webapp < LeapTest end # - # returns true if the per-user db created by tapicero exists. + # returns true if the per-user db created by soledad-server exists. # we try three times, and give up after that. # def assert_user_db_exists(user) -- cgit v1.2.3 From b53bd889d5407fb357329b414bcae929176c0690 Mon Sep 17 00:00:00 2001 From: ankonym Date: Wed, 7 Oct 2015 11:19:26 +0200 Subject: Change webapp tests to work with enabled invite codes This will generate an invite code so test_05_Can_create_and_authenticate_and_delete_user_via_API? will work correctly (when invite codes are required for signups). --- tests/helpers/bonafide_helper.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb index 9b26eaaf..39f761fe 100644 --- a/tests/helpers/bonafide_helper.rb +++ b/tests/helpers/bonafide_helper.rb @@ -32,7 +32,11 @@ class LeapTest def assert_create_user user = SRP::User.new url = api_url("/1/users.json") - assert_post(url, user.to_params) do |body| + + params = user.to_params + params['user[invite_code]'] = generate_invite_code + + assert_post(url, params) do |body| assert response = JSON.parse(body), 'response should be JSON' assert response['ok'], "Creating a user should be successful, got #{response.inspect} instead." end @@ -40,6 +44,13 @@ class LeapTest return user end + def generate_invite_code + if property('webapp.invite_required') + `cd /srv/leap/webapp/ && sudo RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "") + end + end + + # # attempts to authenticate user. if successful, # user object is updated with id and session token. -- cgit v1.2.3 From dc426cc777aec921772c1d8c2fa014d61aa90d33 Mon Sep 17 00:00:00 2001 From: ankonym Date: Wed, 7 Oct 2015 12:11:21 +0200 Subject: Modify bonafide_helper to improve user creation test with invites Will now use the correct user to generate invite codes and only add invite code parameter when invite codes are enabled --- tests/helpers/bonafide_helper.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb index 39f761fe..1a6dc6fe 100644 --- a/tests/helpers/bonafide_helper.rb +++ b/tests/helpers/bonafide_helper.rb @@ -34,7 +34,10 @@ class LeapTest url = api_url("/1/users.json") params = user.to_params - params['user[invite_code]'] = generate_invite_code + + if property('webapp.invite_required') + params['user[invite_code]'] = generate_invite_code + end assert_post(url, params) do |body| assert response = JSON.parse(body), 'response should be JSON' @@ -45,9 +48,7 @@ class LeapTest end def generate_invite_code - if property('webapp.invite_required') - `cd /srv/leap/webapp/ && sudo RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "") - end + `cd /srv/leap/webapp/ && sudo -u leap-webapp RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "") end -- cgit v1.2.3 From 2053883c81d261b5a9af5011bd6f0e8bc709f8d1 Mon Sep 17 00:00:00 2001 From: ankonym Date: Mon, 12 Oct 2015 11:19:21 +0200 Subject: Fix soledad test when invite codes are enabled This provides an invite code when invite codes are enabled while the test runs (but it does not get deleted yet afterwards) --- tests/helpers/bonafide_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb index 1a6dc6fe..82db3973 100644 --- a/tests/helpers/bonafide_helper.rb +++ b/tests/helpers/bonafide_helper.rb @@ -36,7 +36,8 @@ class LeapTest params = user.to_params if property('webapp.invite_required') - params['user[invite_code]'] = generate_invite_code + @invite_code = generate_invite_code + params['user[invite_code]'] = @invite_code end assert_post(url, params) do |body| -- cgit v1.2.3 From d7f8fde6d48568c912733aca6fa3030ccdfcada7 Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 26 Oct 2015 10:56:31 +0100 Subject: [bug] Disable user-creation and soledad test Until we have a proper fix for #7523, we disable this test. - Tested: [unstable.bitmask.net] - Related: #7523 --- tests/white-box/webapp.rb | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'tests') diff --git a/tests/white-box/webapp.rb b/tests/white-box/webapp.rb index 8be6bde2..48507521 100644 --- a/tests/white-box/webapp.rb +++ b/tests/white-box/webapp.rb @@ -41,34 +41,6 @@ class Webapp < LeapTest pass end - def test_05_Can_create_and_authenticate_and_delete_user_via_API? - if property('webapp.allow_registration') - assert_tmp_user - pass - else - skip "New user registrations are disabled." - end - end - - def test_06_Can_sync_Soledad? - return unless property('webapp.allow_registration') - soledad_config = property('definition_files.soledad_service') - if soledad_config && !soledad_config.empty? - soledad_server = pick_soledad_server(soledad_config) - 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' - end - end - private def url_options -- cgit v1.2.3