diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-11-07 14:21:45 -0600 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2011-12-21 14:59:49 +0100 |
commit | 5fc064f13e44812042a617a322bcd6111d2b39b2 (patch) | |
tree | f89503069c5d4eabbb940aff34b9733607ce93d2 /install/ui/test/association_tests.js | |
parent | 49e5555b11d0bee814bce807acacbfeb381379f1 (diff) | |
download | freeipa.git-5fc064f13e44812042a617a322bcd6111d2b39b2.tar.gz freeipa.git-5fc064f13e44812042a617a322bcd6111d2b39b2.tar.xz freeipa.git-5fc064f13e44812042a617a322bcd6111d2b39b2.zip |
Refactored entity object resolution.
The IPA.get_entity() has been modified to accept either entity name
or entity object. If it receives an entity object it will return
the object itself. Otherwise, it will resolve the name in the entity
registry.
The other_entity variables have been modified to store a reference
to the entity object instead of its name. The test cases have been
modified to use real entity objects instead of just the names.
Ticket #2042
Diffstat (limited to 'install/ui/test/association_tests.js')
-rw-r--r-- | install/ui/test/association_tests.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/install/ui/test/association_tests.js b/install/ui/test/association_tests.js index ac517534..547ca9f8 100644 --- a/install/ui/test/association_tests.js +++ b/install/ui/test/association_tests.js @@ -27,11 +27,14 @@ test("Testing serial_associator().", function() { var orig_ipa_batch_command = IPA.batch_command; + var user = IPA.entity({ name: 'user' }); + var group = IPA.entity({ name: 'group' }); + var params = { method: 'add_member', pkey: 'test', - entity: {name:'user'}, - other_entity: 'group' + entity: user, + other_entity: group }; params.values = ['user1', 'user2', 'user3']; @@ -50,7 +53,7 @@ test("Testing serial_associator().", function() { command = that.commands[i]; equals( - command.entity, params.other_entity, + command.entity, params.other_entity.name, 'Checking IPA.command() parameter: entity'); equals( @@ -86,11 +89,14 @@ test("Testing bulk_associator().", function() { var counter = 0; + var user = IPA.entity({ name: 'user' }); + var group = IPA.entity({ name: 'group' }); + var params = { - method: "add_member", - pkey: "test", - entity: {name:"user"}, - other_entity: "group" + method: 'add_member', + pkey: 'test', + entity: user, + other_entity: group }; params.values = ['user1', 'user2', 'user3']; @@ -111,7 +117,7 @@ test("Testing bulk_associator().", function() { 'Checking IPA.command() parameter: primary key'); equals( - that.options[params.other_entity], 'user1,user2,user3', + that.options[params.other_entity.name], 'user1,user2,user3', 'Checking IPA.command() parameter: options[\""+params.other_entity+"\"]'); that.on_success({}); |