mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
Lots of work on tests
This commit is contained in:
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user