mirror of
https://github.com/discourse/discourse.git
synced 2025-06-17 04:52:28 +08:00
REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS
This change is discussed here: https://meta.discourse.org/t/deprecating-es6-compatibility-layer/35821 Prior to this change we were not booting correctly with DISCOURSE_NO_CONSTANTS
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import { present } from 'helpers/qunit-helpers';
|
||||
import ApiKey from 'admin/models/api-key';
|
||||
|
||||
module("Discourse.ApiKey");
|
||||
|
||||
test('create', function() {
|
||||
var apiKey = Discourse.ApiKey.create({id: 123, user: {id: 345}});
|
||||
var apiKey = ApiKey.create({id: 123, user: {id: 345}});
|
||||
|
||||
present(apiKey, 'it creates the api key');
|
||||
present(apiKey.get('user'), 'it creates the user inside');
|
||||
@ -12,7 +13,7 @@ test('create', function() {
|
||||
|
||||
asyncTestDiscourse('find', function() {
|
||||
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve([]));
|
||||
Discourse.ApiKey.find().then(function() {
|
||||
ApiKey.find().then(function() {
|
||||
start();
|
||||
ok(Discourse.ajax.calledWith("/admin/api"), "it GETs the keys");
|
||||
});
|
||||
@ -20,14 +21,14 @@ asyncTestDiscourse('find', function() {
|
||||
|
||||
asyncTestDiscourse('generateMasterKey', function() {
|
||||
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {}}));
|
||||
Discourse.ApiKey.generateMasterKey().then(function() {
|
||||
ApiKey.generateMasterKey().then(function() {
|
||||
start();
|
||||
ok(Discourse.ajax.calledWith("/admin/api/key", {type: 'POST'}), "it POSTs to create a master key");
|
||||
});
|
||||
});
|
||||
|
||||
asyncTestDiscourse('regenerate', function() {
|
||||
var apiKey = Discourse.ApiKey.create({id: 3456});
|
||||
var apiKey = ApiKey.create({id: 3456});
|
||||
|
||||
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 3456}}));
|
||||
apiKey.regenerate().then(function() {
|
||||
@ -37,7 +38,7 @@ asyncTestDiscourse('regenerate', function() {
|
||||
});
|
||||
|
||||
asyncTestDiscourse('revoke', function() {
|
||||
var apiKey = Discourse.ApiKey.create({id: 3456});
|
||||
var apiKey = ApiKey.create({id: 3456});
|
||||
|
||||
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve([]));
|
||||
apiKey.revoke().then(function() {
|
||||
|
Reference in New Issue
Block a user