summaryrefslogtreecommitdiffstats
path: root/install/ui/test/association_tests.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-04-12 02:13:30 -0500
committerAdam Young <ayoung@redhat.com>2011-04-13 23:27:50 -0400
commit805b94f22d42eddee42ed8772aca89036edb8399 (patch)
tree12c6d80ce465b0541cfb15332177f36fba79bc0b /install/ui/test/association_tests.js
parent9cac1d88fcffcce65018869827eadcfc0ff157f1 (diff)
downloadfreeipa-805b94f22d42eddee42ed8772aca89036edb8399.tar.gz
freeipa-805b94f22d42eddee42ed8772aca89036edb8399.tar.xz
freeipa-805b94f22d42eddee42ed8772aca89036edb8399.zip
Merged IPA.cmd() into IPA.command().
The IPA.cmd() has been merged into IPA.command(). All invocations and test cases have been converted. Ticket #988
Diffstat (limited to 'install/ui/test/association_tests.js')
-rw-r--r--install/ui/test/association_tests.js100
1 files changed, 60 insertions, 40 deletions
diff --git a/install/ui/test/association_tests.js b/install/ui/test/association_tests.js
index 41b113d76..bad8d1a84 100644
--- a/install/ui/test/association_tests.js
+++ b/install/ui/test/association_tests.js
@@ -23,37 +23,47 @@ module('associate');
test("Testing serial_associator().", function() {
- expect(7);
+ expect(10);
- var orig_ipa_cmd = IPA.cmd;
+ var orig_ipa_command = IPA.command;
var counter = 0;
var params = {
- method: "add_member",
- pkey: "test",
- entity_name: "user",
- other_entity: "group"
+ method: 'add_member',
+ pkey: 'test',
+ entity_name: 'user',
+ other_entity: 'group'
};
params.values = ['user1', 'user2', 'user3'];
- IPA.cmd = function(name, args, options, win_callback, fail_callback, objname) {
- counter++;
+ IPA.command = function(spec) {
+
+ var that = orig_ipa_command(spec);
+
+ that.execute = function() {
+ counter++;
- equals(
- name, params.other_entity+'_'+params.method,
- "Checking IPA.cmd() parameter: method"
- );
+ equals(
+ that.entity, params.other_entity,
+ 'Checking IPA.command() parameter: entity'
+ );
- equals(
- args[0], "user"+counter,
- "Checking IPA.cmd() parameter: primary key"
- );
+ equals(
+ that.method, params.method,
+ 'Checking IPA.command() parameter: method'
+ );
- var response = {};
- win_callback(response);
- return 0;
+ equals(
+ that.args[0], 'user'+counter,
+ 'Checking IPA.command() parameter: primary key'
+ );
+
+ that.on_success();
+ };
+
+ return that;
};
params.on_success = function() {
@@ -63,14 +73,14 @@ test("Testing serial_associator().", function() {
var associator = IPA.serial_associator(params);
associator.execute();
- IPA.cmd = orig_ipa_cmd;
+ IPA.command = orig_ipa_command;
});
test("Testing bulk_associator().", function() {
- expect(4);
+ expect(5);
- var orig_ipa_cmd = IPA.cmd;
+ var orig_ipa_command = IPA.command;
var counter = 0;
@@ -83,27 +93,37 @@ test("Testing bulk_associator().", function() {
params.values = ['user1', 'user2', 'user3'];
- IPA.cmd = function(name, args, options, win_callback, fail_callback, objname) {
- counter++;
+ IPA.command = function(spec) {
+
+ var that = orig_ipa_command(spec);
+
+ that.execute = function() {
+ counter++;
+
+ equals(
+ that.entity, params.entity_name,
+ 'Checking IPA.command() parameter: entity'
+ );
+
+ equals(
+ that.method, params.method,
+ 'Checking IPA.command() parameter: method'
+ );
- equals(
- name, params.entity_name+'_'+params.method,
- "Checking IPA.cmd() parameter: method"
- );
+ equals(
+ that.args[0], params.pkey,
+ 'Checking IPA.command() parameter: primary key'
+ );
- equals(
- args[0], params.pkey,
- "Checking IPA.cmd() parameter: primary key"
- );
+ equals(
+ that.options[params.other_entity], 'user1,user2,user3',
+ 'Checking IPA.command() parameter: options[\""+params.other_entity+"\"]'
+ );
- equals(
- options[params.other_entity], "user1,user2,user3",
- "Checking IPA.cmd() parameter: options[\""+params.other_entity+"\"]"
- );
+ that.on_success();
+ };
- var response = {};
- win_callback(response);
- return 0;
+ return that;
};
params.on_success = function() {
@@ -113,5 +133,5 @@ test("Testing bulk_associator().", function() {
var associator = IPA.bulk_associator(params);
associator.execute();
- IPA.cmd = orig_ipa_cmd;
+ IPA.command = orig_ipa_command;
});