diff src/test/test_memory.py @ 1271:2308f8405ffb

test: refactoring: - rename internal init methods to reinit - rename getSentMessage to getSentMessageXml - rename getSentMessageRaw to getSentMessage
author souliane <souliane@mailoo.org>
date Fri, 19 Dec 2014 11:36:00 +0100
parents 854880a31717
children 069ad98b360d
line wrap: on
line diff
--- a/src/test/test_memory.py	Mon Dec 15 15:29:08 2014 +0100
+++ b/src/test/test_memory.py	Fri Dec 19 11:36:00 2014 +0100
@@ -136,7 +136,7 @@
         return self.host.memory.getParams(security_limit, app, profile_key)
 
     def test_updateParams(self):
-        self.host.memory.init()
+        self.host.memory.reinit()
         # check if the update works
         self.host.memory.updateParams(self._getParamXML())
         self.assertParamExists()
@@ -145,7 +145,7 @@
         self.host.memory.updateParams(self._getParamXML())
         self.assertEqual(previous.toxml().encode("utf-8"), self.host.memory.params.dom.toxml().encode("utf-8"))
 
-        self.host.memory.init()
+        self.host.memory.reinit()
         # check successive updates (without intersection)
         self.host.memory.updateParams(self._getParamXML('1'))
         self.assertParamExists("1")
@@ -156,7 +156,7 @@
 
         previous = self.host.memory.params.dom.cloneNode(True)  # save for later
 
-        self.host.memory.init()
+        self.host.memory.reinit()
         # check successive updates (with intersection)
         self.host.memory.updateParams(self._getParamXML('1'))
         self.assertParamExists("1")
@@ -168,7 +168,7 @@
         # successive updates with or without intersection should have the same result
         self.assertEqual(previous.toxml().encode("utf-8"), self.host.memory.params.dom.toxml().encode("utf-8"))
 
-        self.host.memory.init()
+        self.host.memory.reinit()
         # one update with two params in a new category
         self.host.memory.updateParams(self._getParamXML('12'))
         self.assertParamExists("1")
@@ -177,21 +177,21 @@
     def test_getParams(self):
         # tests with no security level on the parameter (most secure)
         params = self._getParamXML()
-        self.host.memory.init()
+        self.host.memory.reinit()
         self.host.memory.updateParams(params)
         self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
         self._getParams(0).addCallback(self.assertParamNotExists_async)
         self._getParams(1).addCallback(self.assertParamNotExists_async)
         # tests with security level 0 on the parameter (not secure)
         params = self._getParamXML(security_level=0)
-        self.host.memory.init()
+        self.host.memory.reinit()
         self.host.memory.updateParams(params)
         self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
         self._getParams(0).addCallback(self.assertParamExists_async)
         self._getParams(1).addCallback(self.assertParamExists_async)
         # tests with security level 1 on the parameter (more secure)
         params = self._getParamXML(security_level=1)
-        self.host.memory.init()
+        self.host.memory.reinit()
         self.host.memory.updateParams(params)
         self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
         self._getParams(0).addCallback(self.assertParamNotExists_async)
@@ -213,66 +213,66 @@
 
         # tests with no security level on the parameter (most secure)
         params = self._getParamXML()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
         self.assertParamExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 0, Const.APP_NAME)
         self.assertParamNotExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 1, Const.APP_NAME)
         self.assertParamNotExists()
 
         # tests with security level 0 on the parameter (not secure)
         params = self._getParamXML(security_level=0)
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
         self.assertParamExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 0, Const.APP_NAME)
         self.assertParamExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 1, Const.APP_NAME)
         self.assertParamExists()
 
         # tests with security level 1 on the parameter (more secure)
         params = self._getParamXML(security_level=1)
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
         self.assertParamExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 0, Const.APP_NAME)
         self.assertParamNotExists()
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 1, Const.APP_NAME)
         self.assertParamExists()
 
         # tests with security level 1 and several parameters being registered
         params = self._getParamXML("12", security_level=1)
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
         self.assertParamExists()
         self.assertParamExists("2")
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 0, Const.APP_NAME)
         self.assertParamNotExists()
         self.assertParamNotExists("2")
-        self.host.memory.init()
+        self.host.memory.reinit()
         register(params, 1, Const.APP_NAME)
         self.assertParamExists()
         self.assertParamExists("2")
 
         # tests with several parameters being registered in an existing category
-        self.host.memory.init()
+        self.host.memory.reinit()
         self.host.memory.updateParams(self._getParamXML("3"))
         register(self._getParamXML("12"), Const.NO_SECURITY_LIMIT, Const.APP_NAME)
         self.assertParamExists()
         self.assertParamExists("2")
-        self.host.memory.init()
+        self.host.memory.reinit()
 
     def test_paramsRegisterApp_getParams(self):
         # test retrieving the parameter for a specific frontend
-        self.host.memory.init()
+        self.host.memory.reinit()
         params = self._getParamXML(security_level=1)
         self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
         self._getParams(1, '').addCallback(self.assertParamExists_async)
@@ -280,7 +280,7 @@
         self._getParams(1, 'another_dummy_frontend').addCallback(self.assertParamNotExists_async)
 
         # the same with several parameters registered at the same time
-        self.host.memory.init()
+        self.host.memory.reinit()
         params = self._getParamXML('12', security_level=0)
         self.host.memory.paramsRegisterApp(params, 5, Const.APP_NAME)
         self._getParams(5, '').addCallback(self.assertParamExists_async)