Revert "REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS"

This reverts commit c0b277d273.
This commit is contained in:
Robin Ward
2015-11-20 10:00:12 -05:00
parent 1c8b3c9447
commit c21457d6a7
99 changed files with 384 additions and 394 deletions

View File

@@ -1,13 +1,11 @@
import { blank, present } from 'helpers/qunit-helpers';
import AdminUser from 'admin/models/admin-user';
import ApiKey from 'admin/models/api-key';
module("Discourse.AdminUser");
asyncTestDiscourse('generate key', function() {
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 1234, key: 'asdfasdf'}}));
var adminUser = AdminUser.create({id: 333});
var adminUser = Discourse.AdminUser.create({id: 333});
blank(adminUser.get('api_key'), 'it has no api key by default');
adminUser.generateApiKey().then(function() {
@@ -19,8 +17,8 @@ asyncTestDiscourse('generate key', function() {
asyncTestDiscourse('revoke key', function() {
var apiKey = ApiKey.create({id: 1234, key: 'asdfasdf'}),
adminUser = AdminUser.create({id: 333, api_key: apiKey});
var apiKey = Discourse.ApiKey.create({id: 1234, key: 'asdfasdf'}),
adminUser = Discourse.AdminUser.create({id: 333, api_key: apiKey});
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve());

View File

@@ -1,10 +1,9 @@
import { present } from 'helpers/qunit-helpers';
import ApiKey from 'admin/models/api-key';
module("Discourse.ApiKey");
test('create', function() {
var apiKey = ApiKey.create({id: 123, user: {id: 345}});
var apiKey = Discourse.ApiKey.create({id: 123, user: {id: 345}});
present(apiKey, 'it creates the api key');
present(apiKey.get('user'), 'it creates the user inside');
@@ -13,7 +12,7 @@ test('create', function() {
asyncTestDiscourse('find', function() {
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve([]));
ApiKey.find().then(function() {
Discourse.ApiKey.find().then(function() {
start();
ok(Discourse.ajax.calledWith("/admin/api"), "it GETs the keys");
});
@@ -21,14 +20,14 @@ asyncTestDiscourse('find', function() {
asyncTestDiscourse('generateMasterKey', function() {
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {}}));
ApiKey.generateMasterKey().then(function() {
Discourse.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 = ApiKey.create({id: 3456});
var apiKey = Discourse.ApiKey.create({id: 3456});
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 3456}}));
apiKey.regenerate().then(function() {
@@ -38,7 +37,7 @@ asyncTestDiscourse('regenerate', function() {
});
asyncTestDiscourse('revoke', function() {
var apiKey = ApiKey.create({id: 3456});
var apiKey = Discourse.ApiKey.create({id: 3456});
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve([]));
apiKey.revoke().then(function() {

View File

@@ -1,11 +1,9 @@
import FlaggedPost from 'admin/models/flagged-post';
module("Discourse.FlaggedPost");
test('delete first post', function() {
sandbox.stub(Discourse, 'ajax');
FlaggedPost.create({ id: 1, topic_id: 2, post_number: 1 })
Discourse.FlaggedPost.create({ id: 1, topic_id: 2, post_number: 1 })
.deletePost();
ok(Discourse.ajax.calledWith("/t/2", { type: 'DELETE', cache: false }), "it deleted the topic");
@@ -14,7 +12,7 @@ test('delete first post', function() {
test('delete second post', function() {
sandbox.stub(Discourse, 'ajax');
FlaggedPost.create({ id: 1, topic_id: 2, post_number: 2 })
Discourse.FlaggedPost.create({ id: 1, topic_id: 2, post_number: 2 })
.deletePost();
ok(Discourse.ajax.calledWith("/posts/1", { type: 'DELETE', cache: false }), "it deleted the post");