Change in vdsm[master]: test: moving getInstance to its class

piotr.kliczewski at gmail.com piotr.kliczewski at gmail.com
Fri Oct 2 12:38:22 UTC 2015


Piotr Kliczewski has uploaded a new change for review.

Change subject: test: moving getInstance to its class
......................................................................

test: moving getInstance to its class


Change-Id: Iadc44aef17d1ebcf8b6b7b63fce3fa8d34b4c0a3
Signed-off-by: pkliczewski <piotr.kliczewski at gmail.com>
---
M tests/integration/jsonRpcHelper.py
M tests/integration/jsonRpcTests.py
2 files changed, 10 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/46941/1

diff --git a/tests/integration/jsonRpcHelper.py b/tests/integration/jsonRpcHelper.py
index 73e5758..2e146f7 100644
--- a/tests/integration/jsonRpcHelper.py
+++ b/tests/integration/jsonRpcHelper.py
@@ -59,6 +59,9 @@
         API.StorageDomain.BLANK_UUID = '00000000-0000-0000-0000-000000000000'
         API.Volume.BLANK_UUID = "00000000-0000-0000-0000-000000000000"
 
+    def getInstance(self):
+        return FakeClientIf()
+
     @property
     def ready(self):
         return True
diff --git a/tests/integration/jsonRpcTests.py b/tests/integration/jsonRpcTests.py
index b7fd97d..9186194 100644
--- a/tests/integration/jsonRpcTests.py
+++ b/tests/integration/jsonRpcTests.py
@@ -76,10 +76,6 @@
         self.server_address = None
 
 
-def getInstance():
-    return FakeClientIf()
-
-
 @expandPermutations
 class JsonRpcServerTests(TestCaseBase):
     def _callTimeout(self, client, methodName, params=None, rid=None,
@@ -102,7 +98,7 @@
             finally:
                 client.close()
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testMethodCallArgList(self, ssl, type):
         data = dummyTextGenerator(1024)
@@ -118,7 +114,7 @@
                     self.assertEquals(self._callTimeout(client, "echo",
                                       (data,), CALL_ID), data)
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testMethodCallArgDict(self, ssl, type):
         data = dummyTextGenerator(1024)
@@ -133,7 +129,7 @@
                     self.assertEquals(self._callTimeout(client, "echo",
                                       {'text': data}, CALL_ID), data)
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testMethodMissingMethod(self, ssl, type):
         bridge = _DummyBridge()
@@ -151,7 +147,7 @@
                     self.assertEquals(cm.exception.code,
                                       JsonRpcMethodNotFoundError().code)
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testMethodBadParameters(self, ssl, type):
         # Without a schema the server returns an internal error
@@ -171,7 +167,7 @@
                     self.assertEquals(cm.exception.code,
                                       JsonRpcInternalError().code)
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testMethodReturnsNullAndServerReturnsTrue(self, ssl, type):
         bridge = _DummyBridge()
@@ -187,7 +183,7 @@
                                             CALL_ID)
                     self.assertEquals(res, True)
 
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testDoubleResponse(self, ssl, type):
         bridge = _DummyBridge()
@@ -207,7 +203,7 @@
                     self.assertEquals(res, 'sent')
 
     @slowtest
-    @MonkeyPatch(clientIF, 'getInstance', getInstance)
+    @MonkeyPatch(clientIF, 'getInstance', FakeClientIf.getInstance)
     @permutations(PERMUTATIONS)
     def testSlowMethod(self, ssl, type):
         bridge = _DummyBridge()


-- 
To view, visit https://gerrit.ovirt.org/46941
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadc44aef17d1ebcf8b6b7b63fce3fa8d34b4c0a3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>


More information about the vdsm-patches mailing list