annotate src/test/test_memory.py @ 786:c3acc1298a2f

test: FakeMemory inherits from Memory + more helpers basic support + cleaning
author souliane <souliane@mailoo.org>
date Sun, 05 Jan 2014 13:04:54 +0100
parents 0e5807193721
children 0cb423500fbb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
3
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # SAT: a jabber client
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
6
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # (at your option) any later version.
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
11
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
16
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
19
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
20 from sat.core.i18n import _
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
21 from sat.test import helpers
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
22 from twisted.trial import unittest
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
23 import traceback
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
24 from constants import Const
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
25 from xml.dom import minidom
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
26
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
27
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
28 class MemoryTest(unittest.TestCase):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
29
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
30 def setUp(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
31 self.host = helpers.FakeSAT()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
32
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
33 def _getParamXML(self, name=None, category=None, security_level=None):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
34 if not name:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
35 name = Const.ENABLE_UNIBOX_PARAM
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
36 if not category:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
37 category = Const.ENABLE_UNIBOX_KEY
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
38 return """
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
39 <params>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
40 <individual>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
41 <category name="%(category_name)s" label="%(category_label)s">
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
42 <param name="%(param_name)s" label="%(param_label)s" value="true" type="bool" %(security)s/>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
43 </category>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
44 </individual>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
45 </params>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
46 """ % {
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
47 'category_name': category,
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
48 'category_label': _(category),
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
49 'param_name': name,
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
50 'param_label': _(name),
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
51 'security': '' if security_level is None else ('security="%d"' % security_level)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
52 }
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
53
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
54 def _paramExists(self, name=None, category=None, src=None):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
55 """@return: True is the param (category, name) exists"""
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
56 if not name:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
57 name = Const.ENABLE_UNIBOX_PARAM
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
58 if not category:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
59 category = Const.ENABLE_UNIBOX_KEY
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
60 if src is None:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
61 src = self.host.memory.params.dom.documentElement
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
62 for type_node in src.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
63 # when src comes self.host.memory.params.dom, we have here
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
64 # some "individual" or "general" elements, when it comes
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
65 # from Memory.getParams we have here a "params" elements
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
66 if type_node.nodeName not in ("individual", "general", "params"):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
67 continue
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
68 for cat_node in type_node.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
69 if cat_node.nodeName != "category" or cat_node.getAttribute("name") != category:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
70 continue
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
71 for param in cat_node.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
72 if param.nodeName == "param" and param.getAttribute("name") == name:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
73 return True
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
74 return False
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
75
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
76 def _assert(self, src, true=True):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
77 """@param src: a deferred result from Memory.getParams"""
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
78 assertion = self._paramExists(src=minidom.parseString(src.encode("utf-8")))
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
79 if not true:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
80 assertion = not assertion
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
81 try:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
82 assert(assertion)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
83 except AssertionError as e:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
84 # in this stack we can see the line where the error came from,
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
85 # if limit=5 is not enough you can increase the value
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
86 print "---------------------- stack start ----------------------"
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
87 traceback.print_stack(limit=5 if true else 6)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
88 print "----------------------- stack end -----------------------"
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
89 raise e
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
90
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
91 def _assert_not(self, src):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
92 """@param src: a deferred result from Memory.getParams"""
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
93 self._assert(src, False)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
94
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
95 def _getParams(self, security_limit, app='', profile_key='@NONE@'):
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
96 if profile_key == '@NONE@':
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
97 profile_key = '@DEFAULT@'
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
98 return self.host.memory.getParams(security_limit, app, profile_key)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
99
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
100 def test_updateParams(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
101 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
102 # check if the update works
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
103 self.host.memory.updateParams(self._getParamXML())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
104 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
105 previous = self.host.memory.params.dom.cloneNode(True)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
106 # now check if it is really updated and not duplicated
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
107 self.host.memory.updateParams(self._getParamXML())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
108 self.assertEqual(previous.toxml().encode("utf-8"), self.host.memory.params.dom.toxml().encode("utf-8"))
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
109
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
110 def test_getParams(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
111 # tests with no security level on the parameter (most secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
112 params = self._getParamXML()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
113 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
114 self.host.memory.updateParams(params)
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
115 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
116 self._getParams(0).addCallback(self._assert_not)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
117 self._getParams(1).addCallback(self._assert_not)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
118 # tests with security level 0 on the parameter (not secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
119 params = self._getParamXML(security_level=0)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
120 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
121 self.host.memory.updateParams(params)
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
122 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
123 self._getParams(0).addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
124 self._getParams(1).addCallback(self._assert)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
125 # tests with security level 1 on the parameter (more secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
126 params = self._getParamXML(security_level=1)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
127 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
128 self.host.memory.updateParams(params)
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
129 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
130 self._getParams(0).addCallback(self._assert_not)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
131 self._getParams(1).addCallback(self._assert)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
132
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
133 def test_paramsRegisterApp(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
134 # tests with no security level on the parameter (most secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
135 params = self._getParamXML()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
136 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
137 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
138 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
139 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
140 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
141 assert(not self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
142 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
143 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
144 assert(not self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
145 # tests with security level 0 on the parameter (not secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
146 params = self._getParamXML(security_level=0)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
147 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
148 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
149 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
150 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
151 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
152 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
153 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
154 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
155 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
156 # tests with security level 1 on the parameter (more secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
157 params = self._getParamXML(security_level=1)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
158 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
159 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
160 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
161 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
162 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
163 assert(not self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
164 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
165 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
166 assert(self._paramExists())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
167
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
168 def test_paramsRegisterApp_getParams(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
169 # test retrieving the parameter for a specific frontend
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
170 self.host.memory.init()
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
171 params = self._getParamXML(security_level=1)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
172 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
173 self._getParams(1, '').addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
174 self._getParams(1, Const.APP_NAME).addCallback(self._assert)
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
175 self._getParams(1, 'another_dummy_frontend').addCallback(self._assert_not)