mirror of
https://git.cloudron.io/cloudron/gitea-app.git
synced 2024-11-22 08:01:01 +00:00
get email from profile api
This commit is contained in:
parent
4bb22336f6
commit
e05c7f116a
2 changed files with 26 additions and 3 deletions
|
@ -31,6 +31,6 @@ The e2e tests are located in the `test/` folder and require [nodejs](http://node
|
||||||
cd gogs-app/test
|
cd gogs-app/test
|
||||||
|
|
||||||
npm install
|
npm install
|
||||||
USERNAME=<cloudron username> EMAIL=<cloudron email> PASSWORD=<cloudron password> mocha --bail test.js
|
USERNAME=<cloudron username> PASSWORD=<cloudron password> mocha --bail test.js
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
27
test/test.js
27
test/test.js
|
@ -33,12 +33,11 @@ describe('Application life cycle test', function () {
|
||||||
var app, reponame = 'testrepo';
|
var app, reponame = 'testrepo';
|
||||||
var username = process.env.USERNAME;
|
var username = process.env.USERNAME;
|
||||||
var password = process.env.PASSWORD;
|
var password = process.env.PASSWORD;
|
||||||
var email = process.env.EMAIL;
|
var email, token;
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
if (!process.env.USERNAME) return done(new Error('USERNAME env var not set'));
|
if (!process.env.USERNAME) return done(new Error('USERNAME env var not set'));
|
||||||
if (!process.env.PASSWORD) return done(new Error('PASSWORD env var not set'));
|
if (!process.env.PASSWORD) return done(new Error('PASSWORD env var not set'));
|
||||||
if (!process.env.EMAIL) return done(new Error('EMAIL env var not set'));
|
|
||||||
|
|
||||||
var seleniumJar= require('selenium-server-standalone-jar');
|
var seleniumJar= require('selenium-server-standalone-jar');
|
||||||
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
|
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
|
||||||
|
@ -59,6 +58,30 @@ describe('Application life cycle test', function () {
|
||||||
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can login', function (done) {
|
||||||
|
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||||
|
|
||||||
|
superagent.post('https://' + inspect.apiEndpoint + '/api/v1/developer/login').send({
|
||||||
|
username: username,
|
||||||
|
password: password
|
||||||
|
}).end(function (error, result) {
|
||||||
|
if (error) return done(error);
|
||||||
|
if (result.statusCode !== 200) return done(new Error('Login failed with status ' + result.statusCode));
|
||||||
|
|
||||||
|
token = result.body.token;
|
||||||
|
|
||||||
|
superagent.get('https://' + inspect.apiEndpoint + '/api/v1/profile')
|
||||||
|
.query({ access_token: token }).end(function (error, result) {
|
||||||
|
if (error) return done(error);
|
||||||
|
if (result.statusCode !== 200) return done(new Error('Get profile failed with status ' + result.statusCode));
|
||||||
|
|
||||||
|
email = result.body.email;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('install app', function () {
|
it('install app', function () {
|
||||||
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue