def test_cancel_observe_request_object_instance(self): request = server.CancelObserveRequest() request.add(("TestClient1", (1, 2))) expectedXml = """ <Request> <Type>Observe</Type> <Content> <Clients> <Client> <ID>TestClient1</ID> <Objects> <Object> <ID>1</ID> <ObjectInstance> <ID>2</ID> <CancelObserve/> </ObjectInstance> </Object> </Objects> </Client> </Clients> </Content> </Request> """ self.assertEqualXml(expectedXml, request.serialize())
def test_cancel_observe_request_resource_instance_fails(self): request = server.CancelObserveRequest() with self.assertRaises(server.IpcError) as cm: request.add(("TestClient1", (1, 2, 3, 4))) self.assertEqual("Unsupported path", cm.exception.message)