diff --git a/src/cmd/device-protection.test.js b/src/cmd/device-protection.test.js index 1fdc28b7c..25104ead1 100644 --- a/src/cmd/device-protection.test.js +++ b/src/cmd/device-protection.test.js @@ -36,11 +36,6 @@ describe('DeviceProtectionCommands', () => { }); it('throws an error while getting the protection status of the device', async () => { - const expectedStatus = { - protected: true, - overridden: false - }; - sinon.stub(deviceProtectionCommands, '_getDeviceProtection').rejects(new Error('random error')); let error; diff --git a/test/e2e/device-protection.e2e.js b/test/e2e/device-protection.e2e.js index a1f07c5bd..3012f4483 100644 --- a/test/e2e/device-protection.e2e.js +++ b/test/e2e/device-protection.e2e.js @@ -6,7 +6,7 @@ const { } = require('../lib/env'); -describe('Wi-Fi Commands [@device,@device-protection]', () => { +describe('Device Protection Commands [@device,@device-protection]', () => { const help = [ 'Manage device protection', 'Usage: particle device-protection ', @@ -62,15 +62,15 @@ describe('Wi-Fi Commands [@device,@device-protection]', () => { it('Gets the current device protection status', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'status']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Open device\nRun particle device-protection enable to protect the device.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Open device\nRun particle device-protection enable to protect the device.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); - it('Attempts to disable protection status on an open device', async () => { + it('Attempts to disable protection status on an open device', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is not a protected device.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is not a protected device.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); @@ -78,23 +78,23 @@ describe('Wi-Fi Commands [@device,@device-protection]', () => { it('Enables protection status on the device', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'status']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now a protected device.\nDevice removed from development mode to maintain current settings.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now a protected device.\nDevice removed from development mode to maintain current settings.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); - it('Gets the current status of the device', async () => { - const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable', '--open']); + it('Gets the current status of the device', async () => { + const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable', '--open']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Protected device\nRun particle device-protection disable to put the device in service mode.`); - expect(stderr).to.equal(''); - expect(exitCode).to.equal(0); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Protected device\nRun particle device-protection disable to put the device in service mode.`); + expect(stderr).to.equal(''); + expect(exitCode).to.equal(0); }); - it('Attempts to enable protection status on a protected device', async () => { + it('Attempts to enable protection status on a protected device', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'enable']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is already a protected device.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is already a protected device.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); @@ -102,7 +102,7 @@ describe('Wi-Fi Commands [@device,@device-protection]', () => { it('Puts the device in service mode', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now in service mode.\nA protected device stays in service mode for a total of 20 reboots or 24 hours.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now in service mode.\nA protected device stays in service mode for a total of 20 reboots or 24 hours.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); @@ -110,17 +110,17 @@ describe('Wi-Fi Commands [@device,@device-protection]', () => { it('Turns the device to an open device', async () => { const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable', '--open']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now an open device.\nDevice placed in development mode to maintain current settings.`); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}) is now an open device.\nDevice placed in development mode to maintain current settings.`); expect(stderr).to.equal(''); expect(exitCode).to.equal(0); }); it('Gets the current status of the device', async () => { - const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable', '--open']); + const { stdout, stderr, exitCode } = await cli.run(['device-protection', 'disable', '--open']); - expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Open device\nRun particle device-protection enable to protect the device.`); - expect(stderr).to.equal(''); - expect(exitCode).to.equal(0); + expect(stdout).to.include(`[${DEVICE_ID}] (Product ${PRODUCT_01_DEVICE_01_ID}): Open device\nRun particle device-protection enable to protect the device.`); + expect(stderr).to.equal(''); + expect(exitCode).to.equal(0); }); }); diff --git a/test/e2e/help.e2e.js b/test/e2e/help.e2e.js index 2c30c4926..77ecfeb90 100644 --- a/test/e2e/help.e2e.js +++ b/test/e2e/help.e2e.js @@ -8,42 +8,43 @@ describe('Help & Unknown Command / Argument Handling', () => { const sandbox = sinon.createSandbox(); const commandList = [ 'Commands:', - ' binary Inspect binaries', - ' bundle Creates a bundle of application binary and assets', - ' call Call a particular function on a device', - ' cloud Access Particle cloud functionality', - ' compile Compile a source file, or directory using the cloud compiler', - ' config Configure and switch between multiple accounts', - ' device Manipulate a device', - ' doctor NOT SUPPORTED. Go to the device doctor tool at docs.particle.io/tools/doctor', - ' flash Send firmware to your device', - ' function Call functions on your device', - ' get Retrieve a value from your device', - ' identify Ask for and display device ID via serial', - ' keys Manage your device\'s key pair and server public key', - ' library Manage firmware libraries', - ' list Display a list of your devices, as well as their variables and functions', - ' logic-function Create, execute, and deploy Logic Functions', - ' login Login to the cloud and store an access token locally', - ' logout Log out of your session and clear your saved access token', - ' monitor Connect and display messages from a device', - ' nyan Make your device shout rainbows', - ' preprocess Preprocess a Wiring file (ino) into a C++ file (cpp)', - ' product Access Particle Product functionality [BETA]', - ' project Manage application projects', - ' publish Publish an event to the cloud', - ' serial Simple serial interface to your devices', - ' setup NOT SUPPORTED. Go to setup.particle.io with your browser', - ' subscribe Listen to device event stream', - ' token Manage access tokens (require username/password)', - ' udp Talk UDP to repair devices, run patches, check Wi-Fi, and more!', - ' update Update Device OS on a device via USB', - ' update-cli Update the Particle CLI to the latest version', - ' usb Control USB devices', - ' variable Retrieve and monitor variables on your device', - ' webhook Manage webhooks that react to device event streams', - ' whoami prints signed-in username', - ' wifi Configure Wi-Fi credentials to your device (Supported on Gen 3+ devices).' + ' binary Inspect binaries', + ' bundle Creates a bundle of application binary and assets', + ' call Call a particular function on a device', + ' cloud Access Particle cloud functionality', + ' compile Compile a source file, or directory using the cloud compiler', + ' config Configure and switch between multiple accounts', + ' device Manipulate a device', + ' device-protection Manage device protection', + ' doctor NOT SUPPORTED. Go to the device doctor tool at docs.particle.io/tools/doctor', + ' flash Send firmware to your device', + ' function Call functions on your device', + ' get Retrieve a value from your device', + ' identify Ask for and display device ID via serial', + ' keys Manage your device\'s key pair and server public key', + ' library Manage firmware libraries', + ' list Display a list of your devices, as well as their variables and functions', + ' logic-function Create, execute, and deploy Logic Functions', + ' login Login to the cloud and store an access token locally', + ' logout Log out of your session and clear your saved access token', + ' monitor Connect and display messages from a device', + ' nyan Make your device shout rainbows', + ' preprocess Preprocess a Wiring file (ino) into a C++ file (cpp)', + ' product Access Particle Product functionality [BETA]', + ' project Manage application projects', + ' publish Publish an event to the cloud', + ' serial Simple serial interface to your devices', + ' setup NOT SUPPORTED. Go to setup.particle.io with your browser', + ' subscribe Listen to device event stream', + ' token Manage access tokens (require username/password)', + ' udp Talk UDP to repair devices, run patches, check Wi-Fi, and more!', + ' update Update Device OS on a device via USB', + ' update-cli Update the Particle CLI to the latest version', + ' usb Control USB devices', + ' variable Retrieve and monitor variables on your device', + ' webhook Manage webhooks that react to device event streams', + ' whoami prints signed-in username', + ' wifi Configure Wi-Fi credentials to your device (Supported on Gen 3+ devices).' ]; const allCmds = ['binary inspect', 'binary enable-device-protection', 'binary', 'bundle', 'call', 'cloud list',