summaryrefslogtreecommitdiffstats
path: root/install/static/test
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-10-13 13:07:43 -0400
committerAdam Young <ayoung@redhat.com>2010-10-15 12:51:30 -0400
commitacf5f9cad7438268148dff6c6b74d8c63048409a (patch)
tree04b5c2bd2529c68f7ec3cb59bb7f2f0cf19417be /install/static/test
parent538646c04ccbbef8249da3705eb455e63d075589 (diff)
downloadfreeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.tar.gz
freeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.tar.xz
freeipa-acf5f9cad7438268148dff6c6b74d8c63048409a.zip
multivalue fixes
metadata for phone numbers test date for users Undo works for multivalue JQuery UI buttons have custom classes inputs/fields are now managed inside of objects removed the use of .call. as it was confusing the issue of mismatched parameter lists. Fixed the parameter lists, too.
Diffstat (limited to 'install/static/test')
-rw-r--r--install/static/test/data/json_metadata.json668
-rw-r--r--install/static/test/data/user_mod.json32
-rw-r--r--install/static/test/data/user_show.json43
-rw-r--r--install/static/test/details_tests.html2
-rw-r--r--install/static/test/details_tests.js202
5 files changed, 871 insertions, 76 deletions
diff --git a/install/static/test/data/json_metadata.json b/install/static/test/data/json_metadata.json
index 4a732ac5f..cd617b48e 100644
--- a/install/static/test/data/json_metadata.json
+++ b/install/static/test/data/json_metadata.json
@@ -5,14 +5,12 @@
"messages": {
"button": {
"add": "Add",
+ "delete": "Delete",
"enroll": "Enroll",
"find": "Find",
"reset": "Reset",
"update": "Update"
},
- "search":{
- "quick_links":"Quick Links"
- },
"details": {
"account": "Account Details",
"contact": "Contact Details",
@@ -22,9 +20,14 @@
"misc": "Misc. Information",
"to_top": "Back to Top"
},
-
"login": {
"header": "Logged In As"
+ },
+ "search": {
+ "delete_confirm": "Do you really want to delete the selected entries?",
+ "quick_links": "Quick Links",
+ "select_all": "Select All",
+ "unselect_all": "Unselect All"
}
},
"metadata": {
@@ -149,7 +152,7 @@
"objectclass",
"aci"
],
- "label": "Automount Location",
+ "label": "Automount",
"methods": [
"add",
"del",
@@ -2865,6 +2868,89 @@
"query": false,
"required": true,
"type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
+ "sudocmd": {
+ "attribute_members": {},
+ "container_dn": "cn=sudocmds,cn=accounts",
+ "default_attributes": [
+ "cn",
+ "description"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "SudoCmds",
+ "methods": [
+ "add",
+ "del",
+ "find",
+ "mod",
+ "show"
+ ],
+ "name": "sudocmd",
+ "object_class": [
+ "ipaobject",
+ "ipasudocmd"
+ ],
+ "object_class_config": null,
+ "object_name": "sudocmd",
+ "object_name_plural": "sudocmds",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "command",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "A description of this command",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
},
{
"attribute": false,
@@ -2894,6 +2980,470 @@
],
"uuid_attribute": "ipauniqueid"
},
+ "sudocmdgroup": {
+ "attribute_members": {
+ "member": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberof": [
+ "sudocmdgroup"
+ ]
+ },
+ "container_dn": "cn=sudocmdgroups,cn=accounts",
+ "default_attributes": [
+ "cn",
+ "description",
+ "member",
+ "memberof"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "Sudo Command Groups",
+ "methods": [
+ "add",
+ "add_member",
+ "del",
+ "find",
+ "mod",
+ "remove_member",
+ "show"
+ ],
+ "name": "sudocmdgroup",
+ "object_class": [
+ "ipaobject",
+ "ipasudocmdgrp"
+ ],
+ "object_class_config": null,
+ "object_name": "sudocmdgroup",
+ "object_name_plural": "sudocmdgroups",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "name",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Group name",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Group name",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Group description",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "membercmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "membercmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "membercmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "membercmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
+ "sudorule": {
+ "attribute_members": {
+ "memberallowcmd": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberdenycmd": [
+ "sudocmd",
+ "sudocmdgroup"
+ ],
+ "memberhost": [
+ "host",
+ "hostgroup"
+ ],
+ "memberuser": [
+ "user",
+ "group"
+ ]
+ },
+ "container_dn": "cn=sudorules",
+ "default_attributes": [
+ "cn",
+ "description"
+ ],
+ "hidden_attributes": [
+ "objectclass",
+ "aci"
+ ],
+ "label": "SudoRule",
+ "methods": [
+ "add",
+ "add_allow_command",
+ "add_deny_command",
+ "add_host",
+ "add_user",
+ "del",
+ "find",
+ "mod",
+ "remove_allow_command",
+ "remove_deny_command",
+ "remove_host",
+ "remove_user",
+ "show"
+ ],
+ "name": "sudorule",
+ "object_class": [
+ "ipaassociation",
+ "ipasudorule"
+ ],
+ "object_class_config": null,
+ "object_name": "Sudo Rule",
+ "object_name_plural": "Sudo Rules",
+ "parent_object": "",
+ "primary_key": "cn",
+ "takes_params": [
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "name",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Rule name",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Rule name",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "cn",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": true,
+ "query": false,
+ "required": true,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "desc",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Description",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Description",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "description",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberuser_user",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Users",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Users",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberuser_user",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberhost_host",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Hosts",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Hosts",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberhost_host",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberhost_hostgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Host Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Host Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberhost_hostgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberallowcmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Allow Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Allow Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberallowcmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberdenycmd_sudocmd",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Deny Commands",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Deny Commands",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberdenycmd_sudocmd",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberallowcmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberallowcmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "memberdenycmd_sudocmdgroup",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Sudo Command Groups",
+ "exclude": null,
+ "flags": [
+ "no_update",
+ "no_create",
+ "no_search"
+ ],
+ "hint": null,
+ "include": null,
+ "label": "Sudo Command Groups",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": false,
+ "name": "memberdenycmd_sudocmdgroup",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ }
+ ],
+ "uuid_attribute": "ipauniqueid"
+ },
"taskgroup": {
"attribute_members": {
"member": [
@@ -3102,11 +3652,11 @@
"methods": [
"add",
"del",
+ "disable",
+ "enable",
"find",
- "lock",
"mod",
- "show",
- "unlock"
+ "show"
],
"name": "user",
"object_class": [
@@ -3128,7 +3678,7 @@
"doc": "User login",
"exclude": null,
"flags": [],
- "hint": "Numeric user Identifer",
+ "hint": null,
"include": null,
"label": "User login",
"length": null,
@@ -3507,6 +4057,106 @@
"query": false,
"required": false,
"type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "phone",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Telephone Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Telephone Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "telephonenumber",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "mobile",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Mobile Telephone Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Mobile Telephone Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "mobile",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "pager",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Pager Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Pager Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "pager",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
+ },
+ {
+ "attribute": false,
+ "autofill": false,
+ "class": "Str",
+ "cli_name": "fax",
+ "cli_short_name": null,
+ "default": null,
+ "doc": "Fax Number",
+ "exclude": null,
+ "flags": [],
+ "hint": null,
+ "include": null,
+ "label": "Fax Number",
+ "length": null,
+ "maxlength": null,
+ "minlength": null,
+ "multivalue": true,
+ "name": "facsimiletelephonenumber",
+ "pattern": null,
+ "pattern_errmsg": null,
+ "primary_key": false,
+ "query": false,
+ "required": false,
+ "type": "unicode"
}
],
"uuid_attribute": "ipauniqueid"
diff --git a/install/static/test/data/user_mod.json b/install/static/test/data/user_mod.json
new file mode 100644
index 000000000..87c256273
--- /dev/null
+++ b/install/static/test/data/user_mod.json
@@ -0,0 +1,32 @@
+{
+ "error": null,
+ "id": 6,
+ "result": {
+ "result": {
+ "givenname": [
+ "Kermit"
+ ],
+ "homedirectory": [
+ "/home/kfrog"
+ ],
+ "loginshell": [
+ "/bin/sh"
+ ],
+ "memberof_group": [
+ "ipausers",
+ "muppets"
+ ],
+ "sn": [
+ "Frog"
+ ],
+ "title": [
+ "reporter"
+ ],
+ "uid": [
+ "kfrog"
+ ]
+ },
+ "summary": "Modified user \"kfrog\"",
+ "value": "kfrog"
+ }
+} \ No newline at end of file
diff --git a/install/static/test/data/user_show.json b/install/static/test/data/user_show.json
index 149b24f68..d3e324fde 100644
--- a/install/static/test/data/user_show.json
+++ b/install/static/test/data/user_show.json
@@ -1,17 +1,20 @@
{
"error": null,
- "id": 0,
+ "id": 6,
"result": {
"result": {
"cn": [
"Kermit Frog"
],
- "dn": "uid=kfrog,cn=users,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com",
+ "dn": "uid=kfrog,cn=users,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
+ "facsimiletelephonenumber": [
+ "415-111-0990"
+ ],
"gecos": [
"kfrog"
],
"gidnumber": [
- "1079249051"
+ "1155230701"
],
"givenname": [
"Kermit"
@@ -20,27 +23,23 @@
"/home/kfrog"
],
"ipauniqueid": [
- "41bcf085-8baa-11df-8155-00163e26b89e"
+ "ddbc79a1-cd9a-11df-98ae-525400674dcd"
],
"krbprincipalname": [
- "kfrog@IDM.LAB.BOS.REDHAT.COM"
+ "kfrog@AYOUNG.BOSTON.DEVEL.REDHAT.COM"
],
"loginshell": [
"/bin/sh"
],
"mail": [
- "kfrog@redhat.com"
- ],
- "memberof": [
- "cn=ipausers,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com",
- "cn=muppets,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
- ],
- "memberof_group": [
- "ipausers",
- "muppets"
- ],
+ "kermit@muppets.com"
+ ],
+ "memberof_group": [
+ "ipausers",
+ "muppets"
+ ],
"mepmanagedentry": [
- "cn=kfrog,cn=groups,cn=accounts,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com"
+ "cn=kfrog,cn=groups,cn=accounts,dc=ayoung,dc=boston,dc=devel,dc=redhat,dc=com"
],
"objectclass": [
"top",
@@ -55,17 +54,25 @@
"ipaobject",
"mepOriginEntry"
],
+ "pager": [
+ "415-333-1882"
+ ],
"sn": [
"Frog"
],
+ "telephonenumber": [
+ "212-555-4444",
+ "415-333-1882",
+ "415-111-0990"
+ ],
"uid": [
"kfrog"
],
"uidnumber": [
- "1079249051"
+ "1155230701"
]
},
"summary": null,
"value": "kfrog"
}
-}
+} \ No newline at end of file
diff --git a/install/static/test/details_tests.html b/install/static/test/details_tests.html
index e1b35251c..7c323610c 100644
--- a/install/static/test/details_tests.html
+++ b/install/static/test/details_tests.html
@@ -9,6 +9,8 @@
<script type="text/javascript" src="../jquery-ui.js"></script>
<script type="text/javascript" src="../ipa.js"></script>
<script type="text/javascript" src="../details.js"></script>
+ <script type="text/javascript" src="../entity.js"></script>
+
<script type="text/javascript" src="details_tests.js"></script>
</head>
<body>
diff --git a/install/static/test/details_tests.js b/install/static/test/details_tests.js
index 1a7efc10b..78d633634 100644
--- a/install/static/test/details_tests.js
+++ b/install/static/test/details_tests.js
@@ -19,40 +19,149 @@
*/
-
test("Testing ipa_details_create().", function() {
- var fields = [
- {name:'cn', label:'Entity Name'},
- {name:'description', label:'Description'},
- {name:'number', label:'Entity ID'}
- ];
-
- var sections = [
- {name:'identity', label:'Entity Details', fields:fields}
- ];
-
- var identity = sections[0];
- var key = 'entity';
-
- var container = $("<div/>",{id: key});
- ipa_details_create(container, sections);
-
- same(
- container[0].title, key,
- "Checking container name"
- );
-
- var dl = container.find('dl#identity');
- ok(
- dl,
- "Checking section"
- );
-
- same(
- dl[0].children.length, fields.length,
- "Checking fields"
- );
+ var name = 'NAMENAMENAME';
+ var identity = 'IDIDID';
+
+ var section = ipa_stanza({name:identity, label:name}).
+ input({name:'cn', label:'Entity Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'number', label:'Entity ID'});
+
+
+ var details = section.fields;
+ var parent = $("<div/>");
+ var container = $("<div title='entity'/>");
+ parent.append(container);
+ ipa_details_section_setup(parent,container, section);
+
+ ok(parent.find('hr').length);
+
+ var h2= parent.find('h2');
+ ok(h2.length);
+ ok(h2[0].innerHTML.indexOf(name) > 1,"find name in html");
+
+ var dl = parent.find('dl');
+ ok(dl.length);
+ same(dl[0].children.length,3,"children tag count");
+ same(dl[0].id, identity,"identity");
+ same(details[0].name, dl[0].children[0].title,"name");
+ var d = dl[0].children[0].innerHTML;
+ same(details[0].label+":",d);
+ same(details[2].name,dl[0].children[2].title);
+ d = dl[0].children[2].innerHTML;
+ same(details[2].label+":" ,d);
+
+});
+
+
+
+test("Testing details lifecycle:setup, load, save ().", function(){
+
+ var setup_status_called = false;
+ var save_password_called= false;
+ var load_manager_called = false;
+ var load_success_called = false;
+ var load_failure_called = false;
+ var update_success_called = false;
+ var update_failure_called = false;
+
+ function setup_status(){
+ setup_status_called = true;
+ }
+
+ function save_password(){
+ save_password_called = true;
+ return [];
+ }
+
+ function load_manager(){
+ load_manager_called = true;
+ }
+
+ function setup_st(){
+ }
+ var container = $("<div/>");
+ var obj_name = 'user';
+ ipa_entity_set_details_definition(obj_name, [
+ ipa_stanza({name:'identity', label:'Identity Details'}).
+ input({name:'title', label: 'Title'}).
+ input({name:'givenname', label:'First Name'}).
+ input({name:'sn', label:'Last Name'}).
+ input({name:'cn', label:'Full Name'}).
+ input({name:'displayname', label:'Dispaly Name'}).
+ input({name:'initials', label:'Initials'}),
+ ipa_stanza({name:'account', label:'Account Details'}).
+ input({name:'status', label:'Account Status', setup: setup_status}).
+ input({name:'uid', label:'Login'}).
+ input({name:'userpassword', label:'Password', save: save_password}).
+ input({name:'uidnumber', label:'UID'}).
+ input({name:'gidnumber', label:'GID'}).
+ input({name:'homedirectory', label:'homedirectory'}),
+ ipa_stanza({name:'contact', label:'Contact Details'}).
+ input({name:'mail', label:'E-mail Address'}).
+ input({name:'telephonenumber', label:'Numbers'}),
+ ipa_stanza({name:'address', label:'Mailing Address'}).
+ input({name:'street', label:'Address'}).
+ input({name:'location', label:'City'}).
+ input({name:'state', label:'State', setup: setup_st}).
+ input({name:'postalcode', label:'ZIP'}),
+ ipa_stanza({name:'employee', label:'Employee Information'}).
+ input({name:'ou', label:'Org. Unit'}).
+ input({name:'manager', label:'Manager', load: load_manager}),
+ ipa_stanza({name:'misc', label:'Misc. Information'}).
+ input({name:'carlicense', label:'Car License'})
+ ]);
+
+ ipa_details_create(container, ipa_entity_details_list[obj_name]);
+
+ var contact = container.find('dl#contact.entryattrs');
+ ok(contact);
+ var identity = container.find('dl#identity.entryattrs');
+ ok(identity);
+ var dts= identity.find('dt');
+ ok(dts);
+ same(6, dts.length);
+ same('initials',dts[5].title);
+
+ //TODO extract into Fixture
+ ipa_ajax_options["async"] = false;
+ $.ajaxSetup(ipa_ajax_options);
+ ipa_json_url = './data';
+ ipa_use_static_files = true;
+
+ container.attr('id','user');
+
+ ok (setup_status_called , 'setup status called');
+
+
+ ipa_details_load(container,
+ 'kfrog',
+ function(){load_success_called = true},
+ function(){load_failure_called = true})
+
+ ok (load_success_called,'load success called');
+ ok (!load_failure_called,'load failure not called');
+
+
+ ok (load_manager_called, 'load manager called');
+
+
+ ipa_details_load(container,
+ 'kfrog',
+ function(){load_success_called = true},
+ function(){load_failure_called = true})
+
+
+ ipa_details_update(container,
+ 'kfrog',
+ function(){update_success_called = true},
+ function(){update_failure_called = true})
+
+ ok (update_success_called,'update success called');
+ ok (!update_failure_called,'update failure not called');
+ ok (save_password_called, 'save password called');
});
@@ -64,27 +173,22 @@ test("Testing _ipa_create_text_input().", function(){
var input = _ipa_create_text_input(name, value);
ok(input,"input not null");
- same(input[0].name,name );
- same(input[0].value,value );
- same(input[0].type,"text" );
-});
+ var text = input.find('input');
+ ok(text);
+ same(text[0].name,name );
+ same(text[0].value,value );
+ same(text[0].type,"text" );
+});
test("Testing ipa_details_section_setup()",function(){
- var fields = [
- {name:'cn', label:'Entity Name'},
- {name:'description', label:'Description'},
- {name:'number', label:'Entity ID'}
- ];
-
- var section = {
- name: 'IDIDID',
- label: 'NAMENAMENAME',
- fields: fields
- };
-
+ var section = ipa_stanza({name: 'IDIDID', label: 'NAMENAMENAME'}).
+ input({name:'cn', label:'Entity Name'}).
+ input({name:'description', label:'Description'}).
+ input({name:'number', label:'Entity ID'});
+ var fields = section.fields;
var container = $("<div title='entity'/>");
var details = $("<div/>");
container.append(details);
@@ -106,4 +210,4 @@ test("Testing ipa_details_section_setup()",function(){
same(dl[0].children[2].title, fields[2].name);
same(dl[0].children[2].innerHTML, fields[2].label+":");
-}); \ No newline at end of file
+});