From 55d45f076269eb56005cfa6dc05c8922dc20f9a2 Mon Sep 17 00:00:00 2001 From: Katy Bowman Date: Sun, 3 Mar 2024 12:03:41 -0500 Subject: [PATCH] refactor: remove orgs-v5 access:remove files --- packages/orgs-v5/commands/access/remove.js | 33 ------------ packages/orgs-v5/index.js | 1 - .../unit/commands/access/remove.unit.test.js | 54 ------------------- 3 files changed, 88 deletions(-) delete mode 100644 packages/orgs-v5/commands/access/remove.js delete mode 100644 packages/orgs-v5/test/unit/commands/access/remove.unit.test.js diff --git a/packages/orgs-v5/commands/access/remove.js b/packages/orgs-v5/commands/access/remove.js deleted file mode 100644 index cf87ffd4fb..0000000000 --- a/packages/orgs-v5/commands/access/remove.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -let cli = require('heroku-cli-util') - -async function run(context, heroku) { - let appName = context.app - let request = heroku.delete(`/apps/${appName}/collaborators/${context.args.email}`) - await cli.action(`Removing ${cli.color.cyan(context.args.email)} access from the app ${cli.color.magenta(appName)}`, request) -} - -module.exports = [ - { - topic: 'access', - needsAuth: true, - needsApp: true, - command: 'remove', - description: 'remove users from a team app', - example: '$ heroku access:remove user@email.com --app APP', - args: [{name: 'email', optional: false}], - run: cli.command(run), - }, - { - topic: 'sharing', - command: 'remove', - help: 'this command is now heroku access:remove', - variableArgs: true, - hidden: true, - run: () => { - cli.error(`This command is now ${cli.color.cyan('heroku access:remove')}`) - process.exit(1) - }, - }, -] diff --git a/packages/orgs-v5/index.js b/packages/orgs-v5/index.js index a60ca0f990..f0c6739dd6 100644 --- a/packages/orgs-v5/index.js +++ b/packages/orgs-v5/index.js @@ -16,7 +16,6 @@ exports.topics = [ exports.commands = flatten([ require('./commands/access/add'), - require('./commands/access/remove'), require('./commands/apps/join'), require('./commands/apps/leave'), require('./commands/apps/lock'), diff --git a/packages/orgs-v5/test/unit/commands/access/remove.unit.test.js b/packages/orgs-v5/test/unit/commands/access/remove.unit.test.js deleted file mode 100644 index 640bcef93f..0000000000 --- a/packages/orgs-v5/test/unit/commands/access/remove.unit.test.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' -/* globals after before beforeEach afterEach context nock expect */ - -let cli = require('heroku-cli-util') -let cmd = require('../../../../commands/access/remove')[0] -const proxyquire = require('proxyquire') -const sinon = require('sinon') -let stubDelete = require('../../stub/delete') -let apiDelete - -describe('heroku access:remove', () => { - context('with either a personal or org app', () => { - beforeEach(() => { - cli.mockConsole() - apiDelete = stubDelete.collaboratorsPersonalApp('myapp', 'raulb@heroku.com') - }) - afterEach(() => nock.cleanAll()) - - it('removes the user from an app', () => { - return cmd.run({app: 'myapp', args: {email: 'raulb@heroku.com'}}) - .then(() => expect('').to.eq(cli.stdout)) - .then(() => expect(`Removing raulb@heroku.com access from the app myapp... done -`).to.eq(cli.stderr)) - .then(() => apiDelete.done()) - }) - }) - - context('using old command', () => { - let cmd2 - let cliErrorStub - let processStub - - before(() => { - cliErrorStub = sinon.stub(cli, 'error').returns(() => {}) - cmd2 = proxyquire(('../../../../commands/access/remove'), { - cli: cliErrorStub, - }) - processStub = sinon.stub(process, 'exit').returns(() => {}) - cli.mockConsole() - }) - after(() => { - cliErrorStub.restore() - processStub.restore() - nock.cleanAll() - }) - - it('errors when attempting to use old command', () => { - cmd2[1].run({ - app: 'myapp', - }) - expect(cliErrorStub.called).to.equal(true) - }) - }) -})