Lots of work on tests

This commit is contained in:
Robin Ward
2014-07-30 18:56:01 -04:00
parent b6684e7168
commit 6f36d5996d
43 changed files with 248 additions and 311 deletions

View File

@ -2,7 +2,7 @@ module("Discourse.AdminUser");
asyncTestDiscourse('generate key', function() {
this.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 1234, key: 'asdfasdf'}}));
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 1234, key: 'asdfasdf'}}));
var adminUser = Discourse.AdminUser.create({id: 333});
@ -19,7 +19,7 @@ asyncTestDiscourse('revoke key', function() {
var apiKey = Discourse.ApiKey.create({id: 1234, key: 'asdfasdf'}),
adminUser = Discourse.AdminUser.create({id: 333, api_key: apiKey});
this.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve());
sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve());
equal(adminUser.get('api_key'), apiKey, 'it has the api key in the beginning');
adminUser.revokeApiKey().then(function() {
@ -27,4 +27,4 @@ asyncTestDiscourse('revoke key', function() {
ok(Discourse.ajax.calledWith("/admin/users/333/revoke_api_key", { type: 'DELETE' }), "it DELETEd to the url");
blank(adminUser.get('api_key'), 'it cleared the api_key');
});
});
});