mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
committed by
Adam Young
parent
9cac1d88fc
commit
805b94f22d
@@ -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) {
|
||||
|
||||
equals(
|
||||
name, params.other_entity+'_'+params.method,
|
||||
"Checking IPA.cmd() parameter: method"
|
||||
);
|
||||
var that = orig_ipa_command(spec);
|
||||
|
||||
equals(
|
||||
args[0], "user"+counter,
|
||||
"Checking IPA.cmd() parameter: primary key"
|
||||
);
|
||||
that.execute = function() {
|
||||
counter++;
|
||||
|
||||
var response = {};
|
||||
win_callback(response);
|
||||
return 0;
|
||||
equals(
|
||||
that.entity, params.other_entity,
|
||||
'Checking IPA.command() parameter: entity'
|
||||
);
|
||||
|
||||
equals(
|
||||
that.method, params.method,
|
||||
'Checking IPA.command() parameter: method'
|
||||
);
|
||||
|
||||
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) {
|
||||
|
||||
equals(
|
||||
name, params.entity_name+'_'+params.method,
|
||||
"Checking IPA.cmd() parameter: method"
|
||||
);
|
||||
var that = orig_ipa_command(spec);
|
||||
|
||||
equals(
|
||||
args[0], params.pkey,
|
||||
"Checking IPA.cmd() parameter: primary key"
|
||||
);
|
||||
that.execute = function() {
|
||||
counter++;
|
||||
|
||||
equals(
|
||||
options[params.other_entity], "user1,user2,user3",
|
||||
"Checking IPA.cmd() parameter: options[\""+params.other_entity+"\"]"
|
||||
);
|
||||
equals(
|
||||
that.entity, params.entity_name,
|
||||
'Checking IPA.command() parameter: entity'
|
||||
);
|
||||
|
||||
var response = {};
|
||||
win_callback(response);
|
||||
return 0;
|
||||
equals(
|
||||
that.method, params.method,
|
||||
'Checking IPA.command() parameter: method'
|
||||
);
|
||||
|
||||
equals(
|
||||
that.args[0], params.pkey,
|
||||
'Checking IPA.command() parameter: primary key'
|
||||
);
|
||||
|
||||
equals(
|
||||
that.options[params.other_entity], 'user1,user2,user3',
|
||||
'Checking IPA.command() parameter: options[\""+params.other_entity+"\"]'
|
||||
);
|
||||
|
||||
that.on_success();
|
||||
};
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
@@ -114,18 +114,18 @@ test("Testing details lifecycle: create, setup, load.", function(){
|
||||
|
||||
var result = {};
|
||||
|
||||
IPA.cmd(
|
||||
'user_show',
|
||||
['kfrog'],
|
||||
{},
|
||||
function(data, text_status, xhr) {
|
||||
IPA.command({
|
||||
entity: 'user',
|
||||
method: 'show',
|
||||
args: ['kfrog'],
|
||||
on_success: function(data, text_status, xhr) {
|
||||
result = data.result.result;
|
||||
ok(true, "IPA.cmd() succeeded.");
|
||||
ok(true, "IPA.command() succeeded.");
|
||||
},
|
||||
function(xhr, text_status, error_thrown) {
|
||||
ok(false, "IPA.cmd() failed: "+error_thrown);
|
||||
on_error: function(xhr, text_status, error_thrown) {
|
||||
ok(false, "IPA.command() failed: "+error_thrown);
|
||||
}
|
||||
);
|
||||
}).execute();
|
||||
|
||||
var setup_called = false;
|
||||
var save_called= false;
|
||||
|
||||
@@ -95,7 +95,7 @@ test("Testing IPA.get_member_attribute().", function() {
|
||||
);
|
||||
});
|
||||
|
||||
test("Testing successful IPA.cmd().", function() {
|
||||
test("Testing successful IPA.command().", function() {
|
||||
|
||||
var method = 'method';
|
||||
var args = ['arg1', 'arg2', 'arg3'];
|
||||
@@ -148,7 +148,14 @@ test("Testing successful IPA.cmd().", function() {
|
||||
request.success(xhr, text_status, error_thrown);
|
||||
};
|
||||
|
||||
IPA.cmd(method, args, options, success_handler, error_handler, object);
|
||||
IPA.command({
|
||||
entity: object,
|
||||
method: method,
|
||||
args: args,
|
||||
options: options,
|
||||
on_success: success_handler,
|
||||
on_error: error_handler
|
||||
}).execute();
|
||||
|
||||
equals(
|
||||
ajax_counter, 1,
|
||||
@@ -168,7 +175,7 @@ test("Testing successful IPA.cmd().", function() {
|
||||
$.ajax = orig;
|
||||
});
|
||||
|
||||
test("Testing unsuccessful IPA.cmd().", function() {
|
||||
test("Testing unsuccessful IPA.command().", function() {
|
||||
|
||||
var method = 'method';
|
||||
var args = ['arg1', 'arg2', 'arg3'];
|
||||
@@ -221,7 +228,14 @@ test("Testing unsuccessful IPA.cmd().", function() {
|
||||
request.error(xhr, text_status, error_thrown);
|
||||
};
|
||||
|
||||
IPA.cmd(method, args, options, success_handler, error_handler, object);
|
||||
IPA.command({
|
||||
entity: object,
|
||||
method: method,
|
||||
args: args,
|
||||
options: options,
|
||||
on_success: success_handler,
|
||||
on_error: error_handler
|
||||
}).execute();
|
||||
|
||||
var dialog = IPA.error_dialog.parent('.ui-dialog');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user