diff options
| author | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-02-03 15:44:26 +0000 |
|---|---|---|
| committer | Kenneth Anthony Giusti <kgiusti@apache.org> | 2010-02-03 15:44:26 +0000 |
| commit | d3323694fe07bdb2d3ed67cceef3fd456eeb3c8d (patch) | |
| tree | e9aad63c9e6cebb17179b8b8c40eb7d4cef27c1a /qpid/python/qmf2/tests/basic_method.py | |
| parent | 2e3e4827a8ad0b322f2b6b87fb67b44c7c945a48 (diff) | |
| download | qpid-python-d3323694fe07bdb2d3ed67cceef3fd456eeb3c8d.tar.gz | |
QPID-2261: 1) remove direct reference to schema in QmfData (use schema id instead). 2) schema_id wildcarding query. 3) Prevent set connection calls from returning until after the management threads start.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@906093 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/qmf2/tests/basic_method.py')
| -rw-r--r-- | qpid/python/qmf2/tests/basic_method.py | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/qpid/python/qmf2/tests/basic_method.py b/qpid/python/qmf2/tests/basic_method.py index 745fa5d83c..be2bdff9ab 100644 --- a/qpid/python/qmf2/tests/basic_method.py +++ b/qpid/python/qmf2/tests/basic_method.py @@ -84,9 +84,8 @@ class _agentApp(Thread): # instantiate managed data objects matching the schema - _obj1 = QmfAgentData( self.agent, _schema=_schema ) - _obj1.set_value("index1", 100) - _obj1.set_value("index2", "a name" ) + _obj1 = QmfAgentData( self.agent, _schema=_schema, + _values={"index1":100, "index2":"a name"}) _obj1.set_value("set_string", "UNSET") _obj1.set_value("set_int", 0) _obj1.set_value("query_count", 0) @@ -153,7 +152,8 @@ class _agentApp(Thread): if obj is None: error_info = QmfData.create({"code": -2, "description": - "Bad Object Id."}) + "Bad Object Id."}, + _object_id="_error") self.agent.method_response(wi.get_handle(), _error=error_info) else: @@ -170,13 +170,15 @@ class _agentApp(Thread): if obj is None: error_info = QmfData.create({"code": -3, "description": - "Unknown object id."}) + "Unknown object id."}, + _object_id="_error") self.agent.method_response(wi.get_handle(), _error=error_info) elif obj.get_object_id() != "01545": - error_info = QmfData.create({"code": -4, - "description": - "Unexpected id."}) + error_info = QmfData.create( {"code": -4, + "description": + "Unexpected id."}, + _object_id="_error") self.agent.method_response(wi.get_handle(), _error=error_info) else: @@ -187,15 +189,18 @@ class _agentApp(Thread): self.agent.method_response(wi.get_handle(), {"code" : 0}) else: - error_info = QmfData.create({"code": -5, - "description": - "Bad Args."}) + error_info = QmfData.create( + {"code": -5, + "description": + "Bad Args."}, + _object_id="_error") self.agent.method_response(wi.get_handle(), _error=error_info) else: - error_info = QmfData.create({"code": -1, + error_info = QmfData.create( {"code": -1, "description": - "Unknown method call."}) + "Unknown method call."}, + _object_id="_error") self.agent.method_response(wi.get_handle(), _error=error_info) self.agent.release_workitem(wi) @@ -284,7 +289,7 @@ class BaseTest(unittest.TestCase): # find agents # synchronous query for all objects with schema # invalid method call on each object - # - should throw a ValueError + # - should throw a ValueError - NOT YET. self.notifier = _testNotifier() self.console = qmf2.console.Console(notifier=self.notifier, agent_timeout=3) @@ -313,11 +318,18 @@ class BaseTest(unittest.TestCase): obj_list = self.console.do_query(agent, query) self.assertTrue(len(obj_list) == 2) for obj in obj_list: - self.failUnlessRaises(ValueError, - obj.invoke_method, - "unknown_meth", - {"arg1": -99, "arg2": "Now set!"}, - _timeout=3) + mr = obj.invoke_method("unknown_method", + {"arg1": -99, "arg2": "Now set!"}, + _timeout=3) + # self.failUnlessRaises(ValueError, + # obj.invoke_method, + # "unknown_meth", + # {"arg1": -99, "arg2": "Now set!"}, + # _timeout=3) + self.assertTrue(isinstance(mr, qmf2.console.MethodResult)) + self.assertFalse(mr.succeeded()) + self.assertTrue(isinstance(mr.get_exception(), QmfData)) + self.console.destroy(10) def test_bad_method_no_schema(self): |
