summaryrefslogtreecommitdiffstats
path: root/webapp/tests/client_oauth.test.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-07-19 10:16:44 -0400
committerGitHub <noreply@github.com>2016-07-19 10:16:44 -0400
commit1641370fbedc42e07f7a9b7758286d341f13b624 (patch)
tree0571746e175c7b6da2a5587bda1b8aaca033cc03 /webapp/tests/client_oauth.test.jsx
parent2b0fcd378ce96277f393b89cac1a98d70e1c480f (diff)
downloadchat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.gz
chat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.bz2
chat-1641370fbedc42e07f7a9b7758286d341f13b624.zip
Moving javascript driver back to platform (#3613)
Diffstat (limited to 'webapp/tests/client_oauth.test.jsx')
-rw-r--r--webapp/tests/client_oauth.test.jsx53
1 files changed, 53 insertions, 0 deletions
diff --git a/webapp/tests/client_oauth.test.jsx b/webapp/tests/client_oauth.test.jsx
new file mode 100644
index 000000000..a9a6bd919
--- /dev/null
+++ b/webapp/tests/client_oauth.test.jsx
@@ -0,0 +1,53 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import assert from 'assert';
+import TestHelper from './test_helper.jsx';
+
+describe('Client.OAuth', function() {
+ this.timeout(100000);
+
+ it('registerOAuthApp', function(done) {
+ TestHelper.initBasic(() => {
+ TestHelper.basicClient().enableLogErrorsToConsole(false); // Disabling since this unit test causes an error
+
+ var app = {};
+ app.name = 'test';
+ app.homepage = 'homepage';
+ app.description = 'desc';
+ app.callback_urls = '';
+
+ TestHelper.basicClient().registerOAuthApp(
+ app,
+ function() {
+ done(new Error('not enabled'));
+ },
+ function(err) {
+ assert.equal(err.id, 'api.oauth.register_oauth_app.turn_off.app_error');
+ done();
+ }
+ );
+ });
+ });
+
+ it('allowOAuth2', function(done) {
+ TestHelper.initBasic(() => {
+ TestHelper.basicClient().enableLogErrorsToConsole(false); // Disabling since this unit test causes an error
+
+ TestHelper.basicClient().allowOAuth2(
+ 'GET',
+ '123456',
+ 'http://nowhere.com',
+ 'state',
+ 'scope',
+ function() {
+ done(new Error('not enabled'));
+ },
+ function(err) {
+ assert.equal(err.id, 'api.oauth.allow_oauth.turn_off.app_error');
+ done();
+ }
+ );
+ });
+ });
+});