mirror of
https://git.cloudron.io/cloudron/gitea-app
synced 2025-09-15 09:29:14 +00:00
Add tests
This commit is contained in:
61
test/test.js
Executable file
61
test/test.js
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var execSync = require('child_process').execSync,
|
||||
ejs = require('ejs'),
|
||||
expect = require('expect.js'),
|
||||
fs = require('fs'),
|
||||
mkdirp = require('mkdirp'),
|
||||
path = require('path'),
|
||||
rimraf = require('rimraf'),
|
||||
superagent = require('superagent');
|
||||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
|
||||
describe('Application life cycle test', function () {
|
||||
this.timeout(0);
|
||||
|
||||
var LOCATION = 'test' + Date.now();
|
||||
var app;
|
||||
var username = process.env.USERNAME;
|
||||
var password = process.env.PASSWORD;
|
||||
|
||||
it('build app', function () {
|
||||
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||
});
|
||||
|
||||
it('install app', function () {
|
||||
execSync('cloudron install --new --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||
});
|
||||
|
||||
it('can get app information', function () {
|
||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
|
||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
|
||||
|
||||
expect(app).to.be.an('object');
|
||||
});
|
||||
|
||||
it('can get the main page', function (done) {
|
||||
superagent.get('https://' + app.fqdn).end(function (error, result) {
|
||||
expect(error).to.be(null);
|
||||
expect(result.status).to.eql(200);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('backup app', function () {
|
||||
execSync('cloudron backup --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||
});
|
||||
|
||||
it('restore app', function () {
|
||||
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||
});
|
||||
|
||||
it('uninstall app', function () {
|
||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user