Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

more tests

  • Loading branch information...
commit 40e3df31a3b79838b4d672a37f1e81b46ee12199 1 parent 72ccdec
@sigma sigma authored
Showing with 22 additions and 6 deletions.
  1. +19 −6 tests/test_echo.py
  2. +3 −0  tests/test_getallplugins.py
View
25 tests/test_echo.py
@@ -1,11 +1,12 @@
from mock_transports import TransportFactory
from unittest import TestCase
+from nose.plugins.attrib import attr
+from xml.sax.saxutils import escape as xml_escape
from vmw.vco.client import Client
_fake_url = "http://vco.example.com/vmware-vmo-webcontrol/webservice"
_echo_operation = "echo"
-_echo_msg = "plop"
class TestEcho(TestCase):
@@ -14,10 +15,22 @@ def setUp(self):
self._client = Client(_fake_url,
transport=self._transport)
- def testEcho(self):
+ def _testEchoBase(self, msg):
self._transport.recordTransaction(_echo_operation,
- request_checker = lambda req: req._message == _echo_msg,
- response_params = {'message': _echo_msg})
+ request_checker = lambda req: req._message == msg,
+ response_params = {'message': xml_escape(msg)})
+
+ resp = self._client.echo(msg)
+ self.assertEqual(resp, msg)
+
+ @attr(state="stable")
+ def testEcho(self):
+ self._testEchoBase("plop")
+
+ @attr(state="stable")
+ def testEchoLong(self):
+ self._testEchoBase("repeated pattern"*50)
- resp = self._client.echo(_echo_msg)
- self.assertEqual(resp, _echo_msg)
+ @attr(state="stable")
+ def testEchoXml(self):
+ self._testEchoBase("<foo/><bar>baz</bar>")
View
3  tests/test_getallplugins.py
@@ -1,6 +1,7 @@
import sys
from mock_transports import TransportFactory
from unittest import TestCase
+from nose.plugins.attrib import attr
from vmw.vco.client import Client, Plugin
@@ -25,6 +26,7 @@ def _testPluginBase(self, params):
for p in plugs:
self.assertTrue(isinstance(p, Plugin))
+ @attr(state="stable")
def testBasicPlugin(self):
_params = {'plugins': [{'name': 'plop',
'version': '0.1',
@@ -32,6 +34,7 @@ def testBasicPlugin(self):
'display': 'Plop'}]}
self._testPluginBase(_params)
+ @attr(state="stable")
def testIncompletePlugins(self):
_params = {'plugins': [{'version': '0.1',
'desc': 'plop plug-in',
Please sign in to comment.
Something went wrong with that request. Please try again.