summaryrefslogtreecommitdiffstats
path: root/install/ui/test
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2011-11-16 21:07:20 -0600
committerEndi S. Dewata <edewata@redhat.com>2011-12-06 22:07:52 +0000
commita8ea42bda841c8773d68886614faf9efd38e33bd (patch)
tree92ddaae7ead82784eefb8dde81bc81e91945bfa0 /install/ui/test
parent6f0c16e4289dd1a68bfd673da52a511087d84b9a (diff)
downloadfreeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.tar.gz
freeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.tar.xz
freeipa-a8ea42bda841c8773d68886614faf9efd38e33bd.zip
Fixed entity metadata resolution.
The current code assumes that an entity will always have a corresponding LDAPObject on the server, so it looks for the metadata in a fixed location. This assumption doesn't work for HBAC Test since it is a Command, not an LDAPObject, so the metadata has to be obtained from a different location. A new method get_default_metadata() has been added to allow each entity to find the metadata from the correct location. Ticket #388
Diffstat (limited to 'install/ui/test')
-rw-r--r--install/ui/test/details_tests.js19
-rw-r--r--install/ui/test/entity_tests.js10
-rw-r--r--install/ui/test/navigation_tests.js22
3 files changed, 30 insertions, 21 deletions
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 0a914920c..fee170ba0 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -40,12 +40,13 @@ module('details', {
details_container = $('<div id="details"/>').appendTo(document.body);
- var obj_name = 'user';
- IPA.entity_factories.user=
- function(){
- return IPA.entity({name:obj_name,
- metadata:IPA.metadata.objects.user});
- };
+ IPA.register('user', function(spec) {
+
+ return IPA.entity({
+ name: 'user',
+ metadata: IPA.metadata.objects.user
+ });
+ });
},
teardown: function() {
details_container.remove();
@@ -175,10 +176,10 @@ test("Testing details lifecycle: create, load.", function(){
var that = IPA.entity(spec);
- that.init = function(params) {
- that.entity_init(params);
+ that.init = function() {
+ that.entity_init();
- params.builder.details_facet({
+ that.builder.details_facet({
sections: [
{
name: 'identity',
diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js
index aa53613a3..a81e0b892 100644
--- a/install/ui/test/entity_tests.js
+++ b/install/ui/test/entity_tests.js
@@ -35,12 +35,12 @@ module('entity',{
var that = IPA.entity(spec);
- that.init = function(params) {
- that.entity_init(params);
+ that.init = function() {
+ that.entity_init();
- params.builder.search_facet({
- columns: [ 'uid' ]
- });
+ that.builder.search_facet({
+ columns: [ 'uid' ]
+ });
};
return that;
diff --git a/install/ui/test/navigation_tests.js b/install/ui/test/navigation_tests.js
index f55e29675..2fb1e814a 100644
--- a/install/ui/test/navigation_tests.js
+++ b/install/ui/test/navigation_tests.js
@@ -41,10 +41,11 @@ test("Testing IPA.navigation.create().", function() {
//Force reset of entities
IPA.entities = $.ordered_map();
- IPA.entity_factories.user = function() {
+ IPA.register('user', function(spec) {
+
var that = IPA.entity({
name: 'user',
- metadata:IPA.metadata.objects.user,
+ metadata: IPA.metadata.objects.user,
facets: [
{
type: 'search'
@@ -57,18 +58,25 @@ test("Testing IPA.navigation.create().", function() {
same(container.attr('name'), 'user', 'user container name');
same(container[0].nodeName, 'DIV', 'user container element');
};
+
return that;
- };
- IPA.entity_factories.group = function(){
- var that = IPA.entity({name: 'group',
- metadata:IPA.metadata.objects.group});
+ });
+
+ IPA.register('group', function(spec) {
+
+ var that = IPA.entity({
+ name: 'group',
+ metadata: IPA.metadata.objects.group
+ });
+
that.display = function(container){
group_mock_called = true;
same(container.attr('name'), 'group','user container name');
same(container[0].nodeName, 'DIV', 'user container element');
};
+
return that;
- };
+ });
var navigation_container = $('<div id="navigation"/>').appendTo(document.body);
var entity_container = $('<div id="content"/>').appendTo(document.body);