diff options
author | varac <varacanero@zeromail.org> | 2015-10-23 17:33:29 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2015-10-23 17:33:29 +0200 |
commit | 9898447c39e79d36135ed15ae4a1b7364b22f1bb (patch) | |
tree | 2c6476defe522973f4dfcbf94df8fd447bf99231 | |
parent | 055a8319c90def2d48ce36a2c27383aa78b11179 (diff) | |
parent | 2053883c81d261b5a9af5011bd6f0e8bc709f8d1 (diff) |
Merge remote-tracking branch 'alster-hamburgers/invite_codes' into develop
-rw-r--r-- | tests/helpers/bonafide_helper.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb index 9b26eaaf..82db3973 100644 --- a/tests/helpers/bonafide_helper.rb +++ b/tests/helpers/bonafide_helper.rb @@ -32,7 +32,15 @@ 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 + + if property('webapp.invite_required') + @invite_code = generate_invite_code + params['user[invite_code]'] = @invite_code + end + + 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 +48,11 @@ class LeapTest return user end + def generate_invite_code + `cd /srv/leap/webapp/ && sudo -u leap-webapp RAILS_ENV=production bundle exec rake generate_invites[1]`.gsub(/\n/, "") + end + + # # attempts to authenticate user. if successful, # user object is updated with id and session token. |