Merge "Register Image Names via .setNames()"

This commit is contained in:
Jenkins 2016-06-15 18:45:01 +00:00 committed by Gerrit Code Review
commit 268e44b349
2 changed files with 22 additions and 3 deletions

View File

@ -45,9 +45,8 @@
];
function registerImageType(registry, imageResourceType) {
registry.getResourceType(imageResourceType, {
names: [gettext('Image'), gettext('Images')]
})
registry.getResourceType(imageResourceType)
.setNames(gettext('Image'), gettext('Images'))
.setProperty('checksum', {
label: gettext('Checksum')
})

View File

@ -89,6 +89,26 @@
});
});
describe('loading the module', function () {
var registry;
beforeEach(module('horizon.app.core.images'));
beforeEach(inject(function($injector) {
registry = $injector.get('horizon.framework.conf.resource-type-registry.service');
}));
it('registers names', function() {
// I don't really like testing this at this level, as in a way it's more
// testing the registry features. It's more complicated to mock the entire
// registry in the way you'd basically have to in order to spy on the
// setNames call. It's my opinion that we shouldn't be testing for these
// configurations as part of a module unit test, but I don't have a good
// answer as to how one properly tests that their plugin-based system is
// configured the way they expect it to be.
expect(registry.getResourceType('OS::Glance::Image').getName()).toBe("Images");
});
});
describe('horizon.app.core.images.imageFormats constant', function() {
var imageFormats;