From c0bedac2b1f892cf3e783c2d26b23e3200f7aa3f Mon Sep 17 00:00:00 2001 From: Sara McCutcheon Date: Mon, 14 Aug 2017 15:38:09 -0700 Subject: [PATCH] Improved site:team:add for users on sites w/o the change_management feature (#1750) I don't know why it is making me do this after @ronan approved. --- CHANGELOG.md | 2 + src/Commands/Site/Team/AddCommand.php | 5 +- tests/features/site-team.feature | 24 +- .../fixtures/site-team-add-no-change-mgmt.yml | 283 ++++++++++++++++++ tests/fixtures/site-team-add.yml | 69 +---- .../Commands/Site/Team/AddCommandTest.php | 26 ++ 6 files changed, 346 insertions(+), 63 deletions(-) create mode 100644 tests/fixtures/site-team-add-no-change-mgmt.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 446fdf176..1f860ce6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. This projec - Updated the name of the `longname` field output by `upstream:info` to `label`. (#1747) - Upstreams of types `core` and `custom` are the only ones which appear by default when using `upstream:list`. (#1747) - The `--org` option of the `site:list` command now defaults to `"all"` instead of `null`, but its behavior is unchanged. (#1747) +- The `role` parameter of the `site:team:add` command defaults to `team_member`. (#1750) ### Added - Added a `machine_name` field to the output of `upstream:list`. (#1747) @@ -24,6 +25,7 @@ All notable changes to this project will be documented in this file. This projec ### Fixed - The `org` option of `site:create` now works with machine names and labels as well as UUIDs. (#1747) +- If the `change_management` feature is not enabled on a site, no warning is displayed only if the `role` has been supplied and is not `team_member`. (#1750) ## 1.4.1 - 2017-07-17 ### Fixed diff --git a/src/Commands/Site/Team/AddCommand.php b/src/Commands/Site/Team/AddCommand.php index c5d487967..bca6f4644 100644 --- a/src/Commands/Site/Team/AddCommand.php +++ b/src/Commands/Site/Team/AddCommand.php @@ -26,14 +26,15 @@ class AddCommand extends TerminusCommand implements SiteAwareInterface * @param string $member Email of user * @param string $role [developer|team_member] Role * + * @usage Adds as a team_member to 's team. * @usage Adds as a to 's team. */ - public function add($site_id, $member, $role) + public function add($site_id, $member, $role = 'team_member') { $site = $this->getSite($site_id); $team = $site->getUserMemberships(); - if (!(boolean)$site->getFeature('change_management')) { + if (($role !== 'team_member') && !(boolean)$site->getFeature('change_management')) { $role = 'team_member'; $this->log()->warning( 'Site does not have change management enabled, defaulting to user role {role}.', diff --git a/tests/features/site-team.feature b/tests/features/site-team.feature index f12f827c5..07c1fa9bb 100644 --- a/tests/features/site-team.feature +++ b/tests/features/site-team.feature @@ -9,12 +9,26 @@ Feature: Managing a site's team @vcr site-team-add.yml Scenario: Adding a team member - When I run "terminus site:team:add [[test_site_name]] [[other_user]] --role=team_member" + When I run "terminus site:team:add [[test_site_name]] [[other_user]] developer" And I list the team members on "[[test_site_name]]" - Then I should get: - """ - [[other_user]] - """ + Then I should get: "----------- ----------- ----------------------- ------------- --------------------------------------" + And I should get: "First name Last name Email Role User ID" + And I should get: "------------ ----------- ----------------------- ------------- --------------------------------------" + And I should get: "Dev User devuser@pantheon.io team_member 11111111-1111-1111-1111-111111111111" + And I should get: "Dev User otheruser@pantheon.io developer 3a1d2042-cca3-432e-94c4-12a8f2b6a950" + And I should get: "------------ ----------- ----------------------- ------------- --------------------------------------" + + @vcr site-team-add-no-change-mgmt.yml + Scenario: Adding a team member without change management enabled + When I run "terminus site:team:add [[test_site_name]] [[other_user]] developer" + Then I should see a warning message: Site does not have change management enabled, defaulting to user role team_member. + And I list the team members on "[[test_site_name]]" + Then I should get: "------------ ----------- ----------------------- ------------- --------------------------------------" + And I should get: "First name Last name Email Role User ID" + And I should get: "------------ ----------- ----------------------- ------------- --------------------------------------" + And I should get: "Dev User devuser@pantheon.io team_member 11111111-1111-1111-1111-111111111111" + And I should get: "Dev User otheruser@pantheon.io team_member 3a1d2042-cca3-432e-94c4-12a8f2b6a950" + And I should get: "------------ ----------- ----------------------- ------------- --------------------------------------" @vcr site-team-role.yml Scenario: Changing a team member's role diff --git a/tests/fixtures/site-team-add-no-change-mgmt.yml b/tests/fixtures/site-team-add-no-change-mgmt.yml new file mode 100644 index 000000000..db4b0b0fa --- /dev/null +++ b/tests/fixtures/site-team-add-no-change-mgmt.yml @@ -0,0 +1,283 @@ + +- + request: + method: POST + url: 'https://onebox/api/authorize/machine-token' + headers: + Host: onebox + Expect: null + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:1b587c44-6646-11e6-b1a5-bc764e1022a9:KA4f5RlIx2oWFq0pEYFZH' + Accept: null + body: '{"machine_token":"111111111111111111111111111111111111111111111","client":"terminus"}' + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:56 GMT' + Content-Type: 'application/json; charset=utf-8' + Content-Length: '182' + Connection: keep-alive + X-Pantheon-Trace-Id: f1338c50-6646-11e6-a69e-9d129c74acd7 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"session":"11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ","expires_at":1474055756,"user_id":"11111111-1111-1111-1111-111111111111"}' +- + request: + method: GET + url: 'https://onebox/api/users/11111111-1111-1111-1111-111111111111' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:57 GMT' + Content-Type: application/json + Content-Length: '3327' + Connection: keep-alive + X-Pantheon-Trace-Id: f1cb5f80-6646-11e6-a69e-9d129c74acd7 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"profile": {"utm_term": "", "invites_to_nonuser": 4, "seen_first_time_user_popover": true, "utm_content": "/", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "initial_identity_strategy": null, "utm_campaign": "pantheon.io (organic)", "tracking_first_site_create": 1428723370, "verify": "037eadb020d51ccddba9e06a64908c98", "tracking_first_code_push": 1428811227, "google_adwords_account_registered_sent": 1428707350, "invites_to_user": 8, "utm_medium": "", "job_function": "developer", "tracking_first_workflow_in_live": 1428811293, "tracking_first_team_invite": 1436464837, "firstname": "Dev", "invites_to_site": 12, "lastname": "User", "pda_campaign": null, "utm_source": "https://www.bing.com/search?setmkt=en-US&q=pantheon+san+francisco", "google_adwords_pushed_code_sent": 1428811242, "last-org-spinup": "none", "web_services_business": null, "initial_identity_name": null, "guilty_of_abuse": null, "invites_sent": 12, "tracking_first_site_upgrade": 1437784612, "google_adwords_paid_for_site_sent": 1438018300, "modified": 1458174494, "maxdevsites": 2, "lead_type": "", "organization": " Pantheon Systems, Inc"}, "feature_flags": [{"name": "Experimental Products", "default": false, "enabled": false, "visible": false, "optional": false, "id": "experimental-products"}, {"name": "annotate git tags", "default": false, "enabled": false, "visible": false, "optional": false, "id": "annotate_git_tags"}, {"name": "Cacheserver Add-on", "default": false, "enabled": false, "visible": false, "optional": false, "id": "cacheserver-addon"}, {"name": "Apollo Spinup", "default": true, "enabled": true, "visible": false, "optional": false, "id": "apollo-spinup"}, {"name": "Pantheon One", "default": false, "enabled": false, "visible": false, "optional": false, "id": "one"}, {"name": "Unified User Account Screen ", "default": false, "enabled": false, "visible": true, "optional": false, "id": "apollo-user"}, {"name": "Indexserver Add-on", "default": false, "enabled": false, "visible": true, "optional": false, "id": "indexserver-addon"}, {"name": "Wordpress", "default": false, "enabled": false, "visible": false, "optional": false, "id": "wordpress"}, {"name": "Apollo Self-Service Toggle", "default": true, "enabled": true, "visible": false, "optional": false, "id": "apollo-toggle"}, {"name": "Site Audit Checks", "default": false, "enabled": false, "visible": false, "optional": false, "id": "site_audit_checks"}, {"description": "Enables the new Desk API 2.0 Interface", "default": false, "enabled": true, "visible": true, "percentage": 100, "optional": false, "id": "desk", "name": "desk"}, {"name": "org tags", "default": false, "enabled": false, "visible": true, "optional": false, "id": "org-tags"}, {"name": "Apollo Dashboard", "default": true, "enabled": true, "visible": false, "optional": false, "id": "apollo"}, {"name": "Org Upstream Updates", "default": false, "enabled": false, "visible": false, "optional": false, "id": "org-has-code"}], "user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "dev_sites_count": 2, "id": "11111111-1111-1111-1111-111111111111", "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "devuser@pantheon.io"}' +- + request: + method: GET + url: 'https://onebox/api/site-names/behat-tests' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:58 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: f245bfa0-6646-11e6-a69e-9d129c74acd7 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"id": "11111111-1111-1111-1111-111111111111", "name": "behat-tests"}' +- + request: + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111?site_state=true' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:58 GMT' + Content-Type: application/json + Content-Length: '3516' + Connection: keep-alive + X-Pantheon-Trace-Id: f2811af0-6646-11e6-a69e-9d129c74acd7 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"allow_cacheserver": false, "allow_indexserver": false, "created": 1471385341, "created_by_user_id": "11111111-1111-1111-1111-111111111111", "framework": "wordpress", "holder_id": "11111111-1111-1111-1111-111111111111", "holder_type": "user", "last_code_push": {"timestamp": "2016-08-19T19:05:16", "user_uuid": "11111111-1111-1111-1111-111111111111"}, "migration_completed_at": 1471632727, "migration_started_at": 1471634332, "name": "behat-tests", "owner": "11111111-1111-1111-1111-111111111111", "php_version": "55", "preferred_zone": "chios", "service_level": "free", "upstream": {"url": "https://github.com/pantheon-systems/WordPress", "product_id": "e8fe8550-1ab9-4964-8838-2b9abdccf4bf", "branch": "master"}, "label": "behat tests", "id": "11111111-1111-1111-1111-111111111111", "holder": {"profile": {"utm_term": "", "invites_to_nonuser": 4, "seen_first_time_user_popover": true, "utm_content": "/", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "initial_identity_strategy": null, "utm_campaign": "pantheon.io (organic)", "tracking_first_site_create": 1428723370, "verify": "037eadb020d51ccddba9e06a64908c98", "tracking_first_code_push": 1428811227, "google_adwords_account_registered_sent": 1428707350, "invites_to_user": 8, "utm_medium": "", "job_function": "developer", "tracking_first_workflow_in_live": 1428811293, "tracking_first_team_invite": 1436464837, "firstname": "Dev", "invites_to_site": 12, "lastname": "User", "pda_campaign": null, "utm_source": "https://www.bing.com/search?setmkt=en-US&q=pantheon+san+francisco", "google_adwords_pushed_code_sent": 1428811242, "last-org-spinup": "none", "web_services_business": null, "initial_identity_name": null, "guilty_of_abuse": null, "invites_sent": 12, "tracking_first_site_upgrade": 1437784612, "google_adwords_paid_for_site_sent": 1438018300, "modified": 1458174494, "maxdevsites": 2, "lead_type": "", "organization": " Pantheon Systems, Inc"}, "id": "11111111-1111-1111-1111-111111111111", "email": "devuser@pantheon.io"}, "settings": {"allow_domains": false, "max_num_cdes": 10, "stunnel": false, "replica_verification_strategy": "pt-heartbeat", "owner": "11111111-1111-1111-1111-111111111111", "secure_runtime_access": false, "pingdom": 0, "guilty_of_abuse": null, "created_by_user_id": "11111111-1111-1111-1111-111111111111", "failover_appserver": 0, "migration_started_at": 1471634332, "migration_completed_at": 1471632727, "support_plan": "regular_support", "on_server_development": false, "drush_version": 5, "label": "behat tests", "appserver": 1, "allow_read_slaves": false, "indexserver": 1, "php_version": "55", "php_channel": "stable", "allow_cacheserver": false, "ssl_enabled": null, "min_backups": 0, "service_level": "free", "dedicated_ip": null, "dbserver": 1, "framework": "wordpress", "upstream": {"url": "https://github.com/pantheon-systems/WordPress", "product_id": "e8fe8550-1ab9-4964-8838-2b9abdccf4bf", "branch": "master"}, "cacheserver": 1, "allow_indexserver": false, "preferred_zone": "chios", "pingdom_chance": 0, "holder_id": "11111111-1111-1111-1111-111111111111", "name": "behat-tests", "created": 1471385341, "max_backups": 0, "holder_type": "user", "number_allow_domains": 0, "pingdom_manually_enabled": false, "last_code_push": {"timestamp": "2016-08-19T19:05:16", "user_uuid": "11111111-1111-1111-1111-111111111111"}}, "base_domain": null, "attributes": {"label": "behat tests"}, "add_ons": [{"id": "NewRelic", "label": "New Relic"}]}' +- + request: + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/environments' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:58 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: f2c576f0-6646-11e6-a69e-9d129c74acd7 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"dev": {"watchers": 1, "diffstat": {}, "on_server_development": true, "environment_created": 1471385341, "dns_zone": "pantheonsite.io", "randseed": "DAWMHE2LTF12P5H2DY3URABPX8N16US9", "styx_cluster": "styx-03.pantheon.io", "target_ref": "refs/heads/master", "lock": {"username": null, "password": null, "locked": false}, "target_commit": "cb3f7bbe08bbdc0d2f68e3fa66655c860ec6c24b", "drush_version": 8}, "test": {"environment_created": 1471385344, "dns_zone": "pantheonsite.io", "randseed": "2768L88WYTOBH0MIQPOB6KY42C3L4WZI", "target_ref": "refs/tags/pantheon_test_2", "lock": {"username": null, "password": null, "locked": false}, "target_commit": "cb3f7bbe08bbdc0d2f68e3fa66655c860ec6c24b", "styx_cluster": "styx-03.pantheon.io"}, "live": {"environment_created": 1471385345, "dns_zone": "pantheonsite.io", "randseed": "0G8KI1O49B4E19HYWI5YUYREYHP0A4TJ", "target_ref": "refs/tags/pantheon_live_1", "lock": {"username": null, "password": null, "locked": false}, "target_commit": "1fdf194d3d7a0c930a4f118e1398412765320328", "styx_cluster": "styx-02.pantheon.io"}}' +- + request: + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/features' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:55:59 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: f32c9d30-6646-11e6-9aa2-6117a1834a25 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"support_plan": [{"grantee": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "user"}, "resource": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grantor": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grant": {"id": "support_plan", "support_plan": {"ticket_priority": {"priority": "P3", "sla": null}, "enable_oncall": false, "id": "regular_support"}}}]}' +- + request: + method: POST + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/workflows' + headers: + Host: onebox + Expect: null + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + body: '{"type":"add_site_user_membership","params":{"user_email":"otheruser@pantheon.io","role":"team_member"}}' + response: + status: + http_version: '1.1' + code: '202' + message: Accepted + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:56:03 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: f367d170-6646-11e6-9aa2-6117a1834a25 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + body: '{"final_task_id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "finished_at": 1471636563.628886, "params": {"role": "team_member", "user_email": "otheruser@pantheon.io"}, "reason": "", "result": "succeeded", "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.941896, "task_ids": ["f36d46c8-6646-11e6-8aea-bc764e11bdd3"], "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "type": "add_site_user_membership", "user_id": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": null, "id": "11111111-1111-1111-1111-111111111111", "key": "1471633200", "environment_id": null, "keep_forever": false, "phase": "finished", "queued_time": null, "run_time": 3.6869900226593018, "created_at": 1471636559.909818, "environment": null, "total_time": 3.7190680503845215, "active_description": "Added \"otheruser@pantheon.io\" to site team", "description": "Add user to site team", "step": 1, "has_operation_log_output": false, "number_of_tasks": 1, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.909818Z%27,mode:quick,to:%272016-08-19T20:01:03.628886Z%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "devuser@pantheon.io"}, "user_email": "devuser@pantheon.io", "final_task": {"environment": null, "finished_at": 1471636563.588696, "fn_name": "trigger_task", "params": {"site_id": "11111111-1111-1111-1111-111111111111", "task_type": "add_site_user_membership", "role": "team_member", "user_email": "otheruser@pantheon.io"}, "queued_at": 1471636559.942215, "responses": [{"code": 200, "body": "Sent new site membership email to ''otheruser@pantheon.io''", "error_details": "", "internal_reason": ""}, {"code": 201, "body": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "error_details": "", "internal_reason": ""}], "result": "succeeded", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.942218, "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "11111111-1111-1111-1111-111111111111", "id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "key": "1471633200", "queued_time": 3.0994415283203125e-06, "host": null, "phase": "finished", "created_at": 1471636559.914772, "allow_concurrent": false, "run_time": 3.6464779376983643, "total_time": 3.673923969268799, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.914772Z%27,mode:quick,to:%272016-08-19T20:01:03.588696Z%27))", "type": "add_site_user_membership", "build_url": null, "messages": {"2016-08-19T19:56:03.652834": {"message": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "level": "INFO"}, "2016-08-19T19:56:03.652802": {"message": "Sent new site membership email to ''otheruser@pantheon.io''", "level": "INFO"}}}}' +- + request: + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/memberships/users?limit=100' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 19 Aug 2016 19:56:04 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: f61e3ee0-6646-11e6-9aa2-6117a1834a25 + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '[{"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "team_member", "id": "11111111-1111-1111-1111-111111111111", "key": "11111111-1111-1111-1111-111111111111", "user_id": "11111111-1111-1111-1111-111111111111", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "invites_to_nonuser": 4, "seen_first_time_user_popover": true, "utm_content": "/", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "initial_identity_strategy": null, "utm_campaign": "pantheon.io (organic)", "tracking_first_site_create": 1428723370, "verify": "037eadb020d51ccddba9e06a64908c98", "tracking_first_code_push": 1428811227, "google_adwords_account_registered_sent": 1428707350, "invites_to_user": 9, "utm_medium": "", "job_function": "developer", "tracking_first_workflow_in_live": 1428811293, "tracking_first_team_invite": 1436464837, "firstname": "Dev", "invites_to_site": 13, "lastname": "User", "pda_campaign": null, "utm_source": "https://www.bing.com/search?setmkt=en-US&q=pantheon+san+francisco", "google_adwords_pushed_code_sent": 1428811242, "last-org-spinup": "none", "web_services_business": null, "initial_identity_name": null, "guilty_of_abuse": null, "invites_sent": 13, "tracking_first_site_upgrade": 1437784612, "google_adwords_paid_for_site_sent": 1438018300, "modified": 1458174494, "maxdevsites": 2, "lead_type": "", "organization": " Pantheon Systems, Inc"}, "verified": false, "id": "11111111-1111-1111-1111-111111111111", "email": "devuser@pantheon.io"}}, {"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "team_member", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "tracking_first_organization_invite": 1433793605, "invites_to_nonuser": 2, "seen_first_time_user_popover": true, "utm_content": "", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "web_services_business": null, "initial_identity_strategy": null, "utm_campaign": "", "invites_sent": 19, "verify": "d5a12ecd05e3a95dfeaf21cc71005959", "tracking_first_code_push": 1433802676, "google_adwords_account_registered_sent": 1433793462, "invites_to_user": 17, "utm_medium": "", "job_function": "null", "tracking_first_workflow_in_live": 1433800882, "tracking_first_team_invite": 1439491299, "firstname": "Dev", "invites_to_site": 16, "lastname": "User", "pda_campaign": null, "utm_source": "", "google_adwords_pushed_code_sent": 1433804021, "last-org-spinup": "none", "tracking_first_site_create": 1433800577, "initial_identity_name": null, "guilty_of_abuse": null, "invites_to_org": 3, "tracking_first_site_upgrade": 1433800858, "google_adwords_paid_for_site_sent": 1433801971, "modified": 1433793438, "maxdevsites": 2, "lead_type": "", "organization": " "}, "verified": false, "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "email": "otheruser@pantheon.io"}}]' +- + request: + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/workflows/11111111-1111-1111-1111-111111111111' + headers: + Host: onebox + Accept-Encoding: null + User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' + Content-type: application/json + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' + Accept: null + response: + status: + http_version: '1.1' + code: '200' + message: OK + headers: + Server: nginx + Date: 'Fri, 02 Sep 2016 20:13:01 GMT' + Content-Type: application/json + Transfer-Encoding: chunked + Connection: keep-alive + X-Pantheon-Trace-Id: a64638b0-7149-11e6-925c-119dc2de11df + X-Frame-Options: deny + Access-Control-Allow-Methods: GET + Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' + Cache-Control: no-cache + Pragma: no-cache + Vary: Accept-Encoding + Strict-Transport-Security: max-age=31536000 + body: '{"final_task_id": "9a0157b0-7149-11e6-a7dc-bc764e1141f9", "finished_at": 1472847178.677144, "params": {"product_id": "e8fe8550-1ab9-4964-8838-2b9abdccf4bf"}, "reason": "", "result": "succeeded", "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1472847161.226717, "task_ids": ["99a1969a-7149-11e6-a7dc-bc764e1141f9", "99f09c04-7149-11e6-a7dc-bc764e1141f9", "99f26dea-7149-11e6-a7dc-bc764e1141f9", "99f2f738-7149-11e6-a7dc-bc764e1141f9", "99f378a2-7149-11e6-a7dc-bc764e1141f9", "99f4a984-7149-11e6-a7dc-bc764e1141f9", "99fd8e0a-7149-11e6-a7dc-bc764e1141f9", "9a0157b0-7149-11e6-a7dc-bc764e1141f9"], "trace_id": "99828d40-7149-11e6-af8f-69992fe0d1e7", "type": "deploy_product", "user_id": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": null, "id": "11111111-1111-1111-1111-111111111111", "key": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "environment_id": null, "keep_forever": false, "phase": "finished", "queued_time": null, "run_time": 17.450427055358887, "created_at": 1472847160.448446, "environment": null, "total_time": 18.228698015213013, "active_description": "Deployed CMS", "description": "Deploy a CMS (Drupal or Wordpress)", "step": 8, "has_operation_log_output": false, "number_of_tasks": 8, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:99828d40-7149-11e6-af8f-69992fe0d1e7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-09-02T20:07:40.448446Z%27,mode:quick,to:%272016-09-02T20:17:58.677144Z%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1432325616, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "ronan@getpantheon.com"}, "user_email": "ronan@getpantheon.com", "final_task": {"environment": "dev", "finished_at": 1472847178.602936, "fn_name": "trigger_task", "params": {"wf_type": "deploy_product", "task_type": "add_quicksilver_tasks", "site_id": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "environment_id": "dev"}, "queued_at": 1472847178.587136, "responses": [{"code": 200, "body": "No Quicksilver tasks to add", "error_details": "", "internal_reason": ""}], "result": "succeeded", "site_id": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "started_at": 1472847178.58714, "trace_id": "99828d40-7149-11e6-af8f-69992fe0d1e7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "9993196c-7149-11e6-a7dc-bc764e1141f9", "id": "9a0157b0-7149-11e6-a7dc-bc764e1141f9", "key": "1472846400", "queued_time": 4.0531158447265625e-06, "host": null, "phase": "finished", "created_at": 1472847161.170936, "allow_concurrent": false, "run_time": 0.01579594612121582, "total_time": 17.431999921798706, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:99828d40-7149-11e6-af8f-69992fe0d1e7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-09-02T20:07:41.170936Z%27,mode:quick,to:%272016-09-02T20:17:58.602936Z%27))", "type": "add_quicksilver_tasks", "build_url": null, "messages": {"2016-09-02T20:13:01.819575": {"message": "No Quicksilver tasks to add", "level": "INFO"}}}}' diff --git a/tests/fixtures/site-team-add.yml b/tests/fixtures/site-team-add.yml index 0920f5c2c..0369bcdff 100644 --- a/tests/fixtures/site-team-add.yml +++ b/tests/fixtures/site-team-add.yml @@ -10,11 +10,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:1b587c44-6646-11e6-b1a5-bc764e1022a9:KA4f5RlIx2oWFq0pEYFZH' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:1b587c44-6646-11e6-b1a5-bc764e1022a9:KA4f5RlIx2oWFq0pEYFZH' - verify: '1' - method: post - absolute_url: '' - json: terminus Accept: null body: '{"machine_token":"111111111111111111111111111111111111111111111","client":"terminus"}' response: @@ -47,11 +42,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' - options: get Accept: null response: status: @@ -83,10 +73,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' Accept: null response: status: @@ -118,10 +104,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' Accept: null response: status: @@ -153,11 +135,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' - options: get Accept: null response: status: @@ -189,10 +166,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' Accept: null response: status: @@ -213,7 +186,7 @@ Pragma: no-cache Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 - body: '{"support_plan": [{"grantee": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "user"}, "resource": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grantor": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grant": {"id": "support_plan", "support_plan": {"ticket_priority": {"priority": "P3", "sla": null}, "enable_oncall": false, "id": "regular_support"}}}]}' + body: '{"change_management": true, "support_plan": [{"grantee": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "user"}, "resource": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grantor": {"id": "11111111-1111-1111-1111-111111111111", "problem_space": "site"}, "grant": {"id": "support_plan", "support_plan": {"ticket_priority": {"priority": "P3", "sla": null}, "enable_oncall": false, "id": "regular_support"}}}]}' - request: method: POST @@ -225,13 +198,8 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: post - absolute_url: '' - json: '' Accept: null - body: '{"type":"add_site_user_membership","params":{"user_email":"otheruser@pantheon.io","role":"team_member"}}' + body: '{"type":"add_site_user_membership","params":{"user_email":"otheruser@pantheon.io","role":"developer"}}' response: status: http_version: '1.1' @@ -250,7 +218,7 @@ Cache-Control: no-cache Pragma: no-cache Vary: Accept-Encoding - body: '{"final_task_id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "finished_at": 1471636563.628886, "params": {"role": "team_member", "user_email": "otheruser@pantheon.io"}, "reason": "", "result": "succeeded", "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.941896, "task_ids": ["f36d46c8-6646-11e6-8aea-bc764e11bdd3"], "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "type": "add_site_user_membership", "user_id": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": null, "id": "f36c8544-6646-11e6-8aea-bc764e11bdd3", "key": "1471633200", "environment_id": null, "keep_forever": false, "phase": "finished", "queued_time": null, "run_time": 3.6869900226593018, "created_at": 1471636559.909818, "environment": null, "total_time": 3.7190680503845215, "active_description": "Added \"otheruser@pantheon.io\" to site team", "description": "Add user to site team", "step": 1, "has_operation_log_output": false, "number_of_tasks": 1, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.909818Z%27,mode:quick,to:%272016-08-19T20:01:03.628886Z%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "devuser@pantheon.io"}, "user_email": "devuser@pantheon.io", "final_task": {"environment": null, "finished_at": 1471636563.588696, "fn_name": "trigger_task", "params": {"site_id": "11111111-1111-1111-1111-111111111111", "task_type": "add_site_user_membership", "role": "team_member", "user_email": "otheruser@pantheon.io"}, "queued_at": 1471636559.942215, "responses": [{"code": 200, "body": "Sent new site membership email to ''otheruser@pantheon.io''", "error_details": "", "internal_reason": ""}, {"code": 201, "body": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "error_details": "", "internal_reason": ""}], "result": "succeeded", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.942218, "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "f36c8544-6646-11e6-8aea-bc764e11bdd3", "id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "key": "1471633200", "queued_time": 3.0994415283203125e-06, "host": null, "phase": "finished", "created_at": 1471636559.914772, "allow_concurrent": false, "run_time": 3.6464779376983643, "total_time": 3.673923969268799, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.914772Z%27,mode:quick,to:%272016-08-19T20:01:03.588696Z%27))", "type": "add_site_user_membership", "build_url": null, "messages": {"2016-08-19T19:56:03.652834": {"message": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "level": "INFO"}, "2016-08-19T19:56:03.652802": {"message": "Sent new site membership email to ''otheruser@pantheon.io''", "level": "INFO"}}}}' + body: '{"final_task_id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "finished_at": 1471636563.628886, "params": {"role": "developer", "user_email": "otheruser@pantheon.io"}, "reason": "", "result": "succeeded", "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.941896, "task_ids": ["f36d46c8-6646-11e6-8aea-bc764e11bdd3"], "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "type": "add_site_user_membership", "user_id": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": null, "id": "11111111-1111-1111-1111-111111111111", "key": "1471633200", "environment_id": null, "keep_forever": false, "phase": "finished", "queued_time": null, "run_time": 3.6869900226593018, "created_at": 1471636559.909818, "environment": null, "total_time": 3.7190680503845215, "active_description": "Added \"otheruser@pantheon.io\" to site team", "description": "Add user to site team", "step": 1, "has_operation_log_output": false, "number_of_tasks": 1, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.909818Z%27,mode:quick,to:%272016-08-19T20:01:03.628886Z%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1428707345, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "devuser@pantheon.io"}, "user_email": "devuser@pantheon.io", "final_task": {"environment": null, "finished_at": 1471636563.588696, "fn_name": "trigger_task", "params": {"site_id": "11111111-1111-1111-1111-111111111111", "task_type": "add_site_user_membership", "role": "team_member", "user_email": "otheruser@pantheon.io"}, "queued_at": 1471636559.942215, "responses": [{"code": 200, "body": "Sent new site membership email to ''otheruser@pantheon.io''", "error_details": "", "internal_reason": ""}, {"code": 201, "body": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "error_details": "", "internal_reason": ""}], "result": "succeeded", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1471636559.942218, "trace_id": "f367d170-6646-11e6-9aa2-6117a1834a25", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "11111111-1111-1111-1111-111111111111", "id": "f36d46c8-6646-11e6-8aea-bc764e11bdd3", "key": "1471633200", "queued_time": 3.0994415283203125e-06, "host": null, "phase": "finished", "created_at": 1471636559.914772, "allow_concurrent": false, "run_time": 3.6464779376983643, "total_time": 3.673923969268799, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:f367d170-6646-11e6-9aa2-6117a1834a25%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-08-19T19:50:59.914772Z%27,mode:quick,to:%272016-08-19T20:01:03.588696Z%27))", "type": "add_site_user_membership", "build_url": null, "messages": {"2016-08-19T19:56:03.652834": {"message": {"role": "team_member", "archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111"}, "level": "INFO"}, "2016-08-19T19:56:03.652802": {"message": "Sent new site membership email to ''otheruser@pantheon.io''", "level": "INFO"}}}}' - request: method: GET @@ -261,10 +229,6 @@ User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' - verify: '1' - method: get - absolute_url: '' Accept: null response: status: @@ -285,25 +249,18 @@ Pragma: no-cache Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 - body: '[{"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "team_member", "id": "11111111-1111-1111-1111-111111111111", "key": "11111111-1111-1111-1111-111111111111", "user_id": "11111111-1111-1111-1111-111111111111", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "invites_to_nonuser": 4, "seen_first_time_user_popover": true, "utm_content": "/", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "initial_identity_strategy": null, "utm_campaign": "pantheon.io (organic)", "tracking_first_site_create": 1428723370, "verify": "037eadb020d51ccddba9e06a64908c98", "tracking_first_code_push": 1428811227, "google_adwords_account_registered_sent": 1428707350, "invites_to_user": 9, "utm_medium": "", "job_function": "developer", "tracking_first_workflow_in_live": 1428811293, "tracking_first_team_invite": 1436464837, "firstname": "Dev", "invites_to_site": 13, "lastname": "User", "pda_campaign": null, "utm_source": "https://www.bing.com/search?setmkt=en-US&q=pantheon+san+francisco", "google_adwords_pushed_code_sent": 1428811242, "last-org-spinup": "none", "web_services_business": null, "initial_identity_name": null, "guilty_of_abuse": null, "invites_sent": 13, "tracking_first_site_upgrade": 1437784612, "google_adwords_paid_for_site_sent": 1438018300, "modified": 1458174494, "maxdevsites": 2, "lead_type": "", "organization": " Pantheon Systems, Inc"}, "verified": false, "id": "11111111-1111-1111-1111-111111111111", "email": "devuser@pantheon.io"}}, {"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "team_member", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "tracking_first_organization_invite": 1433793605, "invites_to_nonuser": 2, "seen_first_time_user_popover": true, "utm_content": "", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "web_services_business": null, "initial_identity_strategy": null, "utm_campaign": "", "invites_sent": 19, "verify": "d5a12ecd05e3a95dfeaf21cc71005959", "tracking_first_code_push": 1433802676, "google_adwords_account_registered_sent": 1433793462, "invites_to_user": 17, "utm_medium": "", "job_function": "null", "tracking_first_workflow_in_live": 1433800882, "tracking_first_team_invite": 1439491299, "firstname": "Dev", "invites_to_site": 16, "lastname": "User", "pda_campaign": null, "utm_source": "", "google_adwords_pushed_code_sent": 1433804021, "last-org-spinup": "none", "tracking_first_site_create": 1433800577, "initial_identity_name": null, "guilty_of_abuse": null, "invites_to_org": 3, "tracking_first_site_upgrade": 1433800858, "google_adwords_paid_for_site_sent": 1433801971, "modified": 1433793438, "maxdevsites": 2, "lead_type": "", "organization": " "}, "verified": false, "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "email": "otheruser@pantheon.io"}}]' + body: '[{"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "team_member", "id": "11111111-1111-1111-1111-111111111111", "key": "11111111-1111-1111-1111-111111111111", "user_id": "11111111-1111-1111-1111-111111111111", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "invites_to_nonuser": 4, "seen_first_time_user_popover": true, "utm_content": "/", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "initial_identity_strategy": null, "utm_campaign": "pantheon.io (organic)", "tracking_first_site_create": 1428723370, "verify": "037eadb020d51ccddba9e06a64908c98", "tracking_first_code_push": 1428811227, "google_adwords_account_registered_sent": 1428707350, "invites_to_user": 9, "utm_medium": "", "job_function": "developer", "tracking_first_workflow_in_live": 1428811293, "tracking_first_team_invite": 1436464837, "firstname": "Dev", "invites_to_site": 13, "lastname": "User", "pda_campaign": null, "utm_source": "https://www.bing.com/search?setmkt=en-US&q=pantheon+san+francisco", "google_adwords_pushed_code_sent": 1428811242, "last-org-spinup": "none", "web_services_business": null, "initial_identity_name": null, "guilty_of_abuse": null, "invites_sent": 13, "tracking_first_site_upgrade": 1437784612, "google_adwords_paid_for_site_sent": 1438018300, "modified": 1458174494, "maxdevsites": 2, "lead_type": "", "organization": " Pantheon Systems, Inc"}, "verified": false, "id": "11111111-1111-1111-1111-111111111111", "email": "devuser@pantheon.io"}}, {"archived": false, "invited_by_id": "11111111-1111-1111-1111-111111111111", "role": "developer", "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "key": "11111111-1111-1111-1111-111111111111", "user_id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "site_id": "11111111-1111-1111-1111-111111111111", "user": {"profile": {"utm_term": "", "tracking_first_organization_invite": 1433793605, "invites_to_nonuser": 2, "seen_first_time_user_popover": true, "utm_content": "", "experiments": {"welcome_video": "shown"}, "full_name": "Dev User", "pullFromLive": false, "utm_device": "", "web_services_business": null, "initial_identity_strategy": null, "utm_campaign": "", "invites_sent": 19, "verify": "d5a12ecd05e3a95dfeaf21cc71005959", "tracking_first_code_push": 1433802676, "google_adwords_account_registered_sent": 1433793462, "invites_to_user": 17, "utm_medium": "", "job_function": "null", "tracking_first_workflow_in_live": 1433800882, "tracking_first_team_invite": 1439491299, "firstname": "Dev", "invites_to_site": 16, "lastname": "User", "pda_campaign": null, "utm_source": "", "google_adwords_pushed_code_sent": 1433804021, "last-org-spinup": "none", "tracking_first_site_create": 1433800577, "initial_identity_name": null, "guilty_of_abuse": null, "invites_to_org": 3, "tracking_first_site_upgrade": 1433800858, "google_adwords_paid_for_site_sent": 1433801971, "modified": 1433793438, "maxdevsites": 2, "lead_type": "", "organization": " "}, "verified": false, "id": "3a1d2042-cca3-432e-94c4-12a8f2b6a950", "email": "otheruser@pantheon.io"}}]' - request: - method: POST - url: 'https://terminus.pantheon.io/api/authorize/machine-token' + method: GET + url: 'https://onebox/api/sites/11111111-1111-1111-1111-111111111111/workflows/11111111-1111-1111-1111-111111111111' headers: - Host: terminus.pantheon.io - Expect: null + Host: onebox Accept-Encoding: null User-Agent: 'Terminus/0.11.4 (php_version=7.0.6&script=boot-fs.php)' Content-type: application/json - Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:fb71806e-6646-11e6-ba99-bc764e10b0ce:A38p4MHMn2PyLWv6A0Drp' - headers: 'Bearer 11111111-1111-1111-1111-111111111111:fb71806e-6646-11e6-ba99-bc764e10b0ce:A38p4MHMn2PyLWv6A0Drp' - verify: '1' - method: post - absolute_url: '' - json: terminus + Authorization: 'Bearer 11111111-1111-1111-1111-111111111111:f18ec78c-6646-11e6-941c-bc764e11bdd3:r8RL5J3zDhC1WVtGoufxQ' Accept: null - body: '{"machine_token":"NRobjHROIQzDfmz2XEGzIZrnXP4ooTxG8FIGWracyUESB","client":"terminus"}' response: status: http_version: '1.1' @@ -311,11 +268,11 @@ message: OK headers: Server: nginx - Date: 'Fri, 19 Aug 2016 20:11:41 GMT' - Content-Type: 'application/json; charset=utf-8' - Content-Length: '182' + Date: 'Fri, 02 Sep 2016 20:13:01 GMT' + Content-Type: application/json + Transfer-Encoding: chunked Connection: keep-alive - X-Pantheon-Trace-Id: 245959a0-6649-11e6-a69e-9d129c74acd7 + X-Pantheon-Trace-Id: a64638b0-7149-11e6-925c-119dc2de11df X-Frame-Options: deny Access-Control-Allow-Methods: GET Access-Control-Allow-Headers: 'Origin, Content-Type, Accept' @@ -323,4 +280,4 @@ Pragma: no-cache Vary: Accept-Encoding Strict-Transport-Security: max-age=31536000 - body: '{"session":"cbc3d67f-f2b9-44a0-8dd6-8d63265af96e:24b3af2c-6649-11e6-b51c-bc764e11bdd3:0eJa9qAWPQiGlvc9Cny56","expires_at":1474056701,"user_id":"cbc3d67f-f2b9-44a0-8dd6-8d63265af96e"}' + body: '{"final_task_id": "9a0157b0-7149-11e6-a7dc-bc764e1141f9", "finished_at": 1472847178.677144, "params": {"product_id": "e8fe8550-1ab9-4964-8838-2b9abdccf4bf"}, "reason": "", "result": "succeeded", "role": "owner", "site_id": "11111111-1111-1111-1111-111111111111", "started_at": 1472847161.226717, "task_ids": ["99a1969a-7149-11e6-a7dc-bc764e1141f9", "99f09c04-7149-11e6-a7dc-bc764e1141f9", "99f26dea-7149-11e6-a7dc-bc764e1141f9", "99f2f738-7149-11e6-a7dc-bc764e1141f9", "99f378a2-7149-11e6-a7dc-bc764e1141f9", "99f4a984-7149-11e6-a7dc-bc764e1141f9", "99fd8e0a-7149-11e6-a7dc-bc764e1141f9", "9a0157b0-7149-11e6-a7dc-bc764e1141f9"], "trace_id": "99828d40-7149-11e6-af8f-69992fe0d1e7", "type": "deploy_product", "user_id": "11111111-1111-1111-1111-111111111111", "waiting_for_task_id": null, "id": "11111111-1111-1111-1111-111111111111", "key": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "environment_id": null, "keep_forever": false, "phase": "finished", "queued_time": null, "run_time": 17.450427055358887, "created_at": 1472847160.448446, "environment": null, "total_time": 18.228698015213013, "active_description": "Deployed CMS", "description": "Deploy a CMS (Drupal or Wordpress)", "step": 8, "has_operation_log_output": false, "number_of_tasks": 8, "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:99828d40-7149-11e6-af8f-69992fe0d1e7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-09-02T20:07:40.448446Z%27,mode:quick,to:%272016-09-02T20:17:58.677144Z%27))", "user": {"user_id": "11111111-1111-1111-1111-111111111111", "created_at": 1432325616, "destination_organization_id": null, "is_registered": true, "created_organization_id": null, "password": "SCRUBBED", "email": "ronan@getpantheon.com"}, "user_email": "ronan@getpantheon.com", "final_task": {"environment": "dev", "finished_at": 1472847178.602936, "fn_name": "trigger_task", "params": {"wf_type": "deploy_product", "task_type": "add_quicksilver_tasks", "site_id": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "environment_id": "dev"}, "queued_at": 1472847178.587136, "responses": [{"code": 200, "body": "No Quicksilver tasks to add", "error_details": "", "internal_reason": ""}], "result": "succeeded", "site_id": "39ea8e9a-7fa7-408f-843e-ea493787fba8", "started_at": 1472847178.58714, "trace_id": "99828d40-7149-11e6-af8f-69992fe0d1e7", "user_id": "11111111-1111-1111-1111-111111111111", "workflow_id": "9993196c-7149-11e6-a7dc-bc764e1141f9", "id": "9a0157b0-7149-11e6-a7dc-bc764e1141f9", "key": "1472846400", "queued_time": 4.0531158447265625e-06, "host": null, "phase": "finished", "created_at": 1472847161.170936, "allow_concurrent": false, "run_time": 0.01579594612121582, "total_time": 17.431999921798706, "reason": "", "error_details": "", "internal_reason": "", "trace_log_url": "https://app.logz.io/#/dashboard/kibana?kibanaRoute=discover%3F_a%3D(query:(query_string:(analyze_wildcard:!t,query:%27trace_id:99828d40-7149-11e6-af8f-69992fe0d1e7%27)))%26_g%3D(refreshInterval:(display:Off,pause:!f,value:0),time:(from:%272016-09-02T20:07:41.170936Z%27,mode:quick,to:%272016-09-02T20:17:58.602936Z%27))", "type": "add_quicksilver_tasks", "build_url": null, "messages": {"2016-09-02T20:13:01.819575": {"message": "No Quicksilver tasks to add", "level": "INFO"}}}}' diff --git a/tests/unit_tests/Commands/Site/Team/AddCommandTest.php b/tests/unit_tests/Commands/Site/Team/AddCommandTest.php index 15637a67c..8a2a31ce2 100644 --- a/tests/unit_tests/Commands/Site/Team/AddCommandTest.php +++ b/tests/unit_tests/Commands/Site/Team/AddCommandTest.php @@ -100,4 +100,30 @@ public function testAddCommandRestricted() $out = $this->command->add('mysite', $new_member, $role); $this->assertNull($out); } + + + /** + * Tests the site:team:add command when change_management is not enabled and the role param is not given + */ + public function testAddCommandRestrictedNoRole() + { + $new_member = 'test@example.com'; + $default_role = 'team_member'; + + $this->site->expects($this->never()) + ->method('getFeature'); + $this->user_memberships->expects($this->once()) + ->method('create') + ->willReturn($this->workflow) + ->with($new_member, $default_role); + $this->logger->expects($this->once()) + ->method('log') + ->with( + $this->equalTo('notice'), + $this->equalTo($this->message) + ); + + $out = $this->command->add('mysite', $new_member); + $this->assertNull($out); + } }