Compare commits

..

3 Commits

Author SHA1 Message Date
Girish Ramakrishnan
5e74f21865 Version 1.3.0 2020-06-09 22:21:04 -07:00
Girish Ramakrishnan
070d306838 Add non-sso tests 2020-06-09 22:20:42 -07:00
Girish Ramakrishnan
c9f1071363 Enable optional sso 2020-06-09 21:38:27 -07:00
3 changed files with 62 additions and 2 deletions

View File

@@ -130,3 +130,6 @@
* Update Synapse to 1.14.0 * Update Synapse to 1.14.0
* [Full changelog](https://github.com/matrix-org/synapse/releases/tag/v1.14.0) * [Full changelog](https://github.com/matrix-org/synapse/releases/tag/v1.14.0)
[1.3.0]
* Add optional sso support

View File

@@ -5,7 +5,7 @@
"description": "file://DESCRIPTION.md", "description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG", "changelog": "file://CHANGELOG",
"tagline": "Secure & decentralized communication", "tagline": "Secure & decentralized communication",
"version": "1.2.0", "version": "1.3.0",
"healthCheckPath": "/", "healthCheckPath": "/",
"httpPort": 8008, "httpPort": 8008,
"memoryLimit": 536870912, "memoryLimit": 536870912,
@@ -31,5 +31,6 @@
"changelog": "file://CHANGELOG", "changelog": "file://CHANGELOG",
"postInstallMessage": "file://POSTINSTALL.md", "postInstallMessage": "file://POSTINSTALL.md",
"minBoxVersion": "5.1.4", "minBoxVersion": "5.1.4",
"documentationUrl": "https://cloudron.io/documentation/apps/synapse/" "documentationUrl": "https://cloudron.io/documentation/apps/synapse/",
"optionalSso": true
} }

View File

@@ -58,6 +58,37 @@ describe('Application life cycle test', function () {
}); });
} }
// https://matrix.org/docs/spec/client_server/latest#user-interactive-api-in-the-rest-api
function registerUser(done) {
superagent.post('https://' + app.fqdn + '/_matrix/client/r0/register?kind=user').send({
username: username,
password: password,
inhibit_login: false
}).end(function (error, result) {
// we will first get a 401
let session = result.body.session;
console.log('session is', session);
if (result.statusCode !== 401) return done(new Error('Expecting a 401 ' + result.statusCode));
superagent.post('https://' + app.fqdn + '/_matrix/client/r0/register?kind=user').send({
auth: {
type: 'm.login.dummy',
session: session
},
username: username,
password: password,
inhibit_login: false
}).end(function (error, result) {
if (error) return done(error);
if (result.statusCode !== 200) return done(new Error('Login failed with status ' + result.statusCode));
console.log('registered user with id', result.user_id);
done();
});
});
}
// https://matrix.org/docs/spec/client_server/latest // https://matrix.org/docs/spec/client_server/latest
function checkLogin(done) { function checkLogin(done) {
superagent.post('https://' + app.fqdn + '/_matrix/client/r0/login').send({ superagent.post('https://' + app.fqdn + '/_matrix/client/r0/login').send({
@@ -114,6 +145,31 @@ describe('Application life cycle test', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
// No SSO
it('install app (no sso)', function () {
execSync('cloudron install --no-sso --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('check landing page', checkLandingPage);
it('can register new user', registerUser);
it('can login', checkLogin);
it('check autojoin', checkAutoJoinRoom);
it('create room', createRoom);
it('check room', checkRoom);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
// SSO
it('install app', function () { it('install app', function () {
execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });