From 57b55d8e2fb452607243cc504204df490661df65 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Wed, 24 Jun 2009 15:10:05 +0200 Subject: Add utility functions for plugin unit testing. --- tests/test_xmlrpc/xmlrpc_test.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_xmlrpc/xmlrpc_test.py') diff --git a/tests/test_xmlrpc/xmlrpc_test.py b/tests/test_xmlrpc/xmlrpc_test.py index 42309add1..9c41d053f 100644 --- a/tests/test_xmlrpc/xmlrpc_test.py +++ b/tests/test_xmlrpc/xmlrpc_test.py @@ -27,6 +27,17 @@ import nose from ipalib import api, request from ipalib import errors + +def assert_attr_equal(entry_attrs, attr, value): + assert value in entry_attrs.get(attr, []) + +def assert_is_member(entry_attrs, value, member_attr='member'): + for m in entry_attrs[member_attr]: + if m.startswith(value): + return + assert False + + # Initialize the API. We do this here so that one can run the tests # individually instead of at the top-level. If API.bootstrap() # has already been called we continue gracefully. Other errors will be @@ -52,3 +63,4 @@ class XMLRPC_test(object): nose tear-down fixture. """ request.destroy_context() + -- cgit