Skip to content
This repository
Browse code

[test] added baseline env save/load tests

  • Loading branch information...
commit b01e687417b2bc70abbb0170194611c0b16b9906 1 parent 0e712aa
Farrin Reid blakmatrix authored

Showing 1 changed file with 152 additions and 0 deletions. Show diff stats Hide diff stats

  1. +152 0 test/commands/env-test.js
152 test/commands/env-test.js
@@ -316,4 +316,156 @@ vows.describe('jitsu/commands/env').addBatch({
316 316 .reply(200, '', { 'x-powered-by': 'Nodejitsu' });
317 317 }
318 318 )
  319 +}).addBatch({
  320 + 'env save': shouldNodejitsuOk('The current app should save enviroment variables',
  321 + function setup() {
  322 + jitsu.prompt.override.confirm = 'yes';
  323 + nock('http://api.mockjitsu.com')
  324 + .get('/apps/tester/jitsu')
  325 + .reply(200, {
  326 + app: {
  327 + name: 'application',
  328 + state: 'stopped',
  329 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  330 + subdomain:'application',
  331 + scripts: { start: './server.js' },
  332 + snapshots: [{ filename: 'FILENAME' }]
  333 + }
  334 + }, { 'x-powered-by': 'Nodejitsu' });
  335 + }
  336 + )
  337 +}).addBatch({
  338 + 'env save barbaz': shouldNodejitsuOk('The specified app should save enviroment variables',
  339 + function setup() {
  340 + jitsu.prompt.override.confirm = 'yes';
  341 + nock('http://api.mockjitsu.com')
  342 + .get('/apps/tester/barbaz')
  343 + .reply(200, {
  344 + app: {
  345 + name: 'barbaz',
  346 + state: 'stopped',
  347 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  348 + subdomain:'barbaz',
  349 + scripts: { start: './server.js' },
  350 + snapshots: [{ filename: 'FILENAME' }]
  351 + }
  352 + }, { 'x-powered-by': 'Nodejitsu' });
  353 + }
  354 + )
  355 +}).addBatch({
  356 + 'env save env_vars.json': shouldNodejitsuOk('The current app should save enviroment variables to the specified filename',
  357 + function setup() {
  358 + jitsu.prompt.override.confirm = 'yes';
  359 + nock('http://api.mockjitsu.com')
  360 + .get('/apps/tester/jitsu')
  361 + .reply(200, {
  362 + app: {
  363 + name: 'application',
  364 + state: 'stopped',
  365 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  366 + subdomain:'application',
  367 + scripts: { start: './server.js' },
  368 + snapshots: [{ filename: 'FILENAME' }]
  369 + }
  370 + }, { 'x-powered-by': 'Nodejitsu' });
  371 + }
  372 + )
  373 +}).addBatch({
  374 + 'env save barbaz env_vars.json': shouldNodejitsuOk('The specified app should save enviroment variables to the specified filename',
  375 + function setup() {
  376 + jitsu.prompt.override.confirm = 'yes';
  377 + nock('http://api.mockjitsu.com')
  378 + .get('/apps/tester/barbaz')
  379 + .reply(200, {
  380 + app: {
  381 + name: 'barbaz',
  382 + state: 'stopped',
  383 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  384 + subdomain:'barbaz',
  385 + scripts: { start: './server.js' },
  386 + snapshots: [{ filename: 'FILENAME' }]
  387 + }
  388 + }, { 'x-powered-by': 'Nodejitsu' });
  389 + }
  390 + )
  391 +}).addBatch({
  392 + 'env load': shouldNodejitsuOk('The current app should load enviroment variables from env.json',
  393 + function setup() {
  394 + jitsu.prompt.override.confirm = 'yes';
  395 + nock('http://api.mockjitsu.com')
  396 + .get('/apps/tester/jitsu')
  397 + .reply(200, {
  398 + app: {
  399 + name: 'application',
  400 + state: 'stopped',
  401 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  402 + subdomain:'application',
  403 + scripts: { start: './server.js' },
  404 + snapshots: [{ filename: 'FILENAME' }]
  405 + }
  406 + }, { 'x-powered-by': 'Nodejitsu' })
  407 + .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
  408 + .reply(200, '', { 'x-powered-by': 'Nodejitsu' });
  409 + }
  410 + )
  411 +}).addBatch({
  412 + 'env load barbaz': shouldNodejitsuOk('The specified app should load enviroment variables from env.json',
  413 + function setup() {
  414 + jitsu.prompt.override.confirm = 'yes';
  415 + nock('http://api.mockjitsu.com')
  416 + .get('/apps/tester/barbaz')
  417 + .reply(200, {
  418 + app: {
  419 + name: 'barbaz',
  420 + state: 'stopped',
  421 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  422 + subdomain:'barbaz',
  423 + scripts: { start: './server.js' },
  424 + snapshots: [{ filename: 'FILENAME' }]
  425 + }
  426 + }, { 'x-powered-by': 'Nodejitsu' })
  427 + .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
  428 + .reply(200, '', { 'x-powered-by': 'Nodejitsu' });
  429 + }
  430 + )
  431 +}).addBatch({
  432 + 'env load enviroment.json': shouldNodejitsuOk('The current app should load enviroment variables from the specified file',
  433 + function setup() {
  434 + jitsu.prompt.override.confirm = 'yes';
  435 + nock('http://api.mockjitsu.com')
  436 + .get('/apps/tester/jitsu')
  437 + .reply(200, {
  438 + app: {
  439 + name: 'application',
  440 + state: 'stopped',
  441 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  442 + subdomain:'application',
  443 + scripts: { start: './server.js' },
  444 + snapshots: [{ filename: 'FILENAME' }]
  445 + }
  446 + }, { 'x-powered-by': 'Nodejitsu' })
  447 + .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
  448 + .reply(200, '', { 'x-powered-by': 'Nodejitsu' });
  449 + }
  450 + )
  451 +}).addBatch({
  452 + 'env load barbaz enviroment.json': shouldNodejitsuOk('The specified app should load enviroment variables from the specified file',
  453 + function setup() {
  454 + jitsu.prompt.override.confirm = 'yes';
  455 + nock('http://api.mockjitsu.com')
  456 + .get('/apps/tester/barbaz')
  457 + .reply(200, {
  458 + app: {
  459 + name: 'barbaz',
  460 + state: 'stopped',
  461 + env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
  462 + subdomain:'barbaz',
  463 + scripts: { start: './server.js' },
  464 + snapshots: [{ filename: 'FILENAME' }]
  465 + }
  466 + }, { 'x-powered-by': 'Nodejitsu' })
  467 + .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
  468 + .reply(200, '', { 'x-powered-by': 'Nodejitsu' });
  469 + }
  470 + )
319 471 }).export(module);

0 comments on commit b01e687

Please sign in to comment.
Something went wrong with that request. Please try again.