Skip to content

Commit

Permalink
[test] apps deploy test
Browse files Browse the repository at this point in the history
  • Loading branch information
jfhbrook committed Feb 24, 2012
1 parent fefbbc0 commit 5767b38
Showing 1 changed file with 85 additions and 1 deletion.
86 changes: 85 additions & 1 deletion test/commands/apps-test.js
Expand Up @@ -168,4 +168,88 @@ vows.describe('jitsu/commands/apps').addBatch({
process.chdir(mainDirectory);
assert.ok(!err);
})
}).export(module);
})

.addBatch({
'apps deploy': shouldNodejitsuOk(function setup() {

useAppFixture();

jitsu.prompt.override.answer = 'yes';

nock('http://api.mockjitsu.com')
.filteringRequestBody(function (route) {
return '*';
})
.post('/apps/tester/example-app/snapshots/0.0.0-2', '*')
.reply(200, {
app: { state: 'stopped' }
}, { 'x-powered-by': 'Nodejitsu' })

nock('http://api.mockjitsu.com')
.get('/apps/tester/example-app')
.reply(200, {
app: {
name: 'example-app',
state: 'stopped',
subdomain:'example-app',
scripts: { start: './server.js' },
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' })
.put('/apps/tester/example-app', {
name: 'example-app',
subdomain: 'example-app',
scripts: {
start: 'server.js'
},
version: '0.0.0-2'
})
.reply(200, {
app: { state: 'stopped' }
}, { 'x-powered-by': 'Nodejitsu' })
.post('/apps/tester/example-app/snapshots/0.0.0-2/activate', {})
.reply(200, {
app: {
name: 'example-app',
subdomain: 'example-app',
scripts: { start: 'server.js' },
version: '0.0.0-2'
}
}, { 'x-powered-by': 'Nodejitsu' })
.post('/apps/tester/example-app/stop', {})
.reply(200, {
app: {
name: 'example-app',
subdomain: 'example-app',
scripts: { start: 'server.js' },
version: '0.0.0-2'
}
}, { 'x-powered-by': 'Nodejitsu' })
.post('/apps/tester/example-app/start', {})
.reply(200, {
app: {
name: 'example-app',
subdomain: 'example-app',
scripts: { start: 'server.js' },
version: '0.0.0'
}
}, { 'x-powered-by': 'Nodejitsu' })
.get('/apps/tester/example-app')
.reply(200, {
app: {
name: 'example-app',
subdomain: 'example-app',
scripts: { start: 'server.js' },
version: '0.0.0-2'
}
}, { 'x-powered-by': 'Nodejitsu' });

}, function assertion (err) {
console.error(err && err.stack);
process.chdir(mainDirectory);
assert.ok(!err);
})
})

.export(module);

0 comments on commit 5767b38

Please sign in to comment.