aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 15:40:22 -0800
committerGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 15:40:22 -0800
commit755569a3d7aad123db0854e282b731d80c3f9ca2 (patch)
tree183734086f02ae10504df22efe7427fb295eabe5 /test
parent71b93fc7486380a6a73ecd38cb0872d62da4227f (diff)
downloadSurfer-755569a3d7aad123db0854e282b731d80c3f9ca2.tar.gz
Surfer-755569a3d7aad123db0854e282b731d80c3f9ca2.tar.zst
Surfer-755569a3d7aad123db0854e282b731d80c3f9ca2.zip
complete the tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/test.js b/test/test.js
index 85c5c04..c0d86d2 100755
--- a/test/test.js
+++ b/test/test.js
@@ -4,6 +4,8 @@
4 4
5var execSync = require('child_process').execSync, 5var execSync = require('child_process').execSync,
6 expect = require('expect.js'), 6 expect = require('expect.js'),
7 fs = require('fs'),
8 os = require('os'),
7 path = require('path'), 9 path = require('path'),
8 superagent = require('superagent'); 10 superagent = require('superagent');
9 11
@@ -12,7 +14,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
12describe('Application life cycle test', function () { 14describe('Application life cycle test', function () {
13 this.timeout(0); 15 this.timeout(0);
14 var LOCATION = 'surfertest'; 16 var LOCATION = 'surfertest';
15 var app; 17 var app, testFile = os.tmpdir() + '/surfer-test.txt';
16 var username = process.env.USERNAME; 18 var username = process.env.USERNAME;
17 var password = process.env.PASSWORD; 19 var password = process.env.PASSWORD;
18 20
@@ -31,7 +33,7 @@ describe('Application life cycle test', function () {
31 execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); 33 execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
32 }); 34 });
33 35
34 it('install app', function () { 36 xit('install app', function () {
35 execSync('cloudron install --new --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); 37 execSync('cloudron install --new --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
36 }); 38 });
37 39
@@ -52,13 +54,14 @@ describe('Application life cycle test', function () {
52 }); 54 });
53 }); 55 });
54 56
55 it('can login using cli', function (done) { 57 it('can login using cli', function () {
56 execSync(__dirname + '../cli/surfer.js login https://' + app.fqdn, { input: username + '\n' + password + '\n' }); 58 // execSync(__dirname + '/../cli/surfer.js login https://' + app.fqdn, { input: username + '\n' + password + '\n' });
57 done(); 59 fs.writeFileSync(process.env.HOME + '/.surfer.json', JSON.stringify({ server: 'https://' + app.fqdn, username: username, password: password }));
58 }); 60 });
59 61
60 it('can upload file', function (done) { 62 it('can upload file', function (done) {
61 execSync(__dirname + '../cli/surfer.js put test.js'); 63 fs.writeFileSync(testFile, 'surfer');
64 execSync(__dirname + '/../cli/surfer.js put ' + testFile, { stdio: 'inherit' } );
62 done(); 65 done();
63 }); 66 });
64 67
@@ -71,12 +74,14 @@ describe('Application life cycle test', function () {
71 }); 74 });
72 75
73 it('can get the uploaded file', function (done) { 76 it('can get the uploaded file', function (done) {
74 var testFile = execSync(__dirname + '../cli/surfer.js get test.js').toString('utf8'); 77 var contents = execSync(__dirname + '/../cli/surfer.js get test/test.js').toString('utf8');
75 console.log(testFile); 78 expect(contents).to.be('surfer');
76 done(); 79 done();
77 }); 80 });
78 81
79 xit('uninstall app', function () { 82 xit('uninstall app', function () {
80 execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); 83 execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
84 fs.unlinkSync(process.env.HOME + '/.surfer.json');
85 fs.unlinkSync(testFile);
81 }); 86 });
82}); 87});