Upgrade ember-qunit
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import Badge from 'discourse/models/badge';
|
||||
import { mapRoutes } from 'discourse/mapping-router';
|
||||
|
||||
moduleFor('controller:admin-user-badges', {
|
||||
setup() {
|
||||
this.registry.register('router:main', mapRoutes());
|
||||
},
|
||||
needs: ['controller:adminUser']
|
||||
});
|
||||
|
||||
|
||||
@@ -4,21 +4,24 @@ import ApiKey from 'admin/models/api-key';
|
||||
|
||||
module("model:admin-user");
|
||||
|
||||
test('generate key', function() {
|
||||
test('generate key', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var adminUser = AdminUser.create({id: 333});
|
||||
blank(adminUser.get('api_key'), 'it has no api key by default');
|
||||
adminUser.generateApiKey().then(function() {
|
||||
assert.ok(!adminUser.get('api_key'), 'it has no api key by default');
|
||||
return adminUser.generateApiKey().then(function() {
|
||||
present(adminUser.get('api_key'), 'it has an api_key now');
|
||||
});
|
||||
});
|
||||
|
||||
test('revoke key', function() {
|
||||
test('revoke key', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var apiKey = ApiKey.create({id: 1234, key: 'asdfasdf'}),
|
||||
adminUser = AdminUser.create({id: 333, api_key: apiKey});
|
||||
|
||||
equal(adminUser.get('api_key'), apiKey, 'it has the api key in the beginning');
|
||||
adminUser.revokeApiKey().then(function() {
|
||||
assert.equal(adminUser.get('api_key'), apiKey, 'it has the api key in the beginning');
|
||||
return adminUser.revokeApiKey().then(function() {
|
||||
blank(adminUser.get('api_key'), 'it cleared the api_key');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user