annotate src/test/test_memory.py @ 2377:e50aee5caf33

frontends (xmlui): new _xmlui_for_name attribute: _xmlui_for_name is an attribute which can be set to Label widgets to indicate the name of the linked widget. This attribute is set automatically for LabelContainer. data argument in _parseChilds is now a dict (or None)
author Goffi <goffi@goffi.org>
date Mon, 16 Oct 2017 07:21:44 +0200
parents 2daf7b4c6756
children 8b37a62336c3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1934
2daf7b4c6756 use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents: 1910
diff changeset
1 #!/usr/bin/env python2
782
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
1766
d17772b0fe22 copyright update
Goffi <goffi@goffi.org>
parents: 1396
diff changeset
5 # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org)
782
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
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
33 def _getParamXML(self, param="1", security_level=None):
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
34 """Generate XML for testing parameters
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
35
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
36 @param param (str): a subset of "123"
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
37 @param security_level: security level of the parameters
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
38 @return (str)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
39 """
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
40 def getParam(name):
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
41 return """
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
42 <param name="%(param_name)s" label="%(param_label)s" value="true" type="bool" %(security)s/>
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
43 """ % {'param_name': name,
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
44 'param_label': _(name),
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
45 'security': '' if security_level is None else ('security="%d"' % security_level)
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
46 }
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
47 params = ''
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
48 if "1" in param:
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
49 params += getParam(Const.ENABLE_UNIBOX_PARAM)
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
50 if "2" in param:
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
51 params += getParam(Const.PARAM_IN_QUOTES)
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
52 if "3" in param:
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
53 params += getParam("Dummy param")
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
54 return """
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
55 <params>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
56 <individual>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
57 <category name="%(category_name)s" label="%(category_label)s">
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
58 %(params)s
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
59 </category>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
60 </individual>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
61 </params>
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
62 """ % {
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
63 'category_name': Const.COMPOSITION_KEY,
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
64 'category_label': _(Const.COMPOSITION_KEY),
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
65 'params': params
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
66 }
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
67
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
68 def _paramExists(self, param="1", src=None):
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
69 """
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
70
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
71 @param param (str): a character in "12"
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
72 @param src (DOM element): the top-level element to look in
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
73 @return: True is the param exists
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
74 """
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
75 if param == "1":
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
76 name = Const.ENABLE_UNIBOX_PARAM
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
77 else:
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
78 name = Const.PARAM_IN_QUOTES
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
79 category = Const.COMPOSITION_KEY
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
80 if src is None:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
81 src = self.host.memory.params.dom.documentElement
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
82 for type_node in src.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
83 # 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
84 # some "individual" or "general" elements, when it comes
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
85 # from Memory.getParams we have here a "params" elements
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
86 if type_node.nodeName not in ("individual", "general", "params"):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
87 continue
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
88 for cat_node in type_node.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
89 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
90 continue
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
91 for param in cat_node.childNodes:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
92 if param.nodeName == "param" and param.getAttribute("name") == name:
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
93 return True
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
94 return False
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
95
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
96 def assertParam_generic(self, param="1", src=None, exists=True, deferred=False):
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
97 """
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
98 @param param (str): a character in "12"
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
99 @param src (DOM element): the top-level element to look in
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
100 @param exists (boolean): True to assert the param exists, False to assert it doesn't
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
101 @param deferred (boolean): True if this method is called from a Deferred callback
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
102 """
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
103 msg = "Expected parameter not found!\n" if exists else "Unexpected parameter found!\n"
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
104 if deferred:
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
105 # in this stack we can see the line where the error came from,
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
106 # if limit=5, 6 is not enough you can increase the value
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
107 msg += "\n".join(traceback.format_stack(limit=5 if exists else 6))
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
108 assertion = self._paramExists(param, src)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
109 getattr(self, "assert%s" % exists)(assertion, msg)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
110
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
111 def assertParamExists(self, param="1", src=None):
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
112 self.assertParam_generic(param, src, True)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
113
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
114 def assertParamNotExists(self, param="1", src=None):
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
115 self.assertParam_generic(param, src, False)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
116
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
117 def assertParamExists_async(self, src, param="1"):
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
118 """@param src: a deferred result from Memory.getParams"""
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
119 self.assertParam_generic(param, minidom.parseString(src.encode("utf-8")), True, True)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
120
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
121 def assertParamNotExists_async(self, src, param="1"):
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
122 """@param src: a deferred result from Memory.getParams"""
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
123 self.assertParam_generic(param, minidom.parseString(src.encode("utf-8")), False, True)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
124
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
125 def _getParams(self, security_limit, app='', profile_key='@NONE@'):
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
126 """Get the parameters accessible with the given security limit and application name.
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
127
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
128 @param security_limit (int): the security limit
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
129 @param app (str): empty string or "libervia"
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
130 @param profile_key
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
131 """
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
132 if profile_key == '@NONE@':
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
133 profile_key = '@DEFAULT@'
1910
55440ee00905 test: update some tests
souliane <souliane@mailoo.org>
parents: 1909
diff changeset
134 return self.host.memory.params.getParams(security_limit, app, profile_key)
786
c3acc1298a2f test: FakeMemory inherits from Memory + more helpers basic support + cleaning
souliane <souliane@mailoo.org>
parents: 782
diff changeset
135
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
136 def test_updateParams(self):
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
137 self.host.memory.reinit()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
138 # check if the update works
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
139 self.host.memory.updateParams(self._getParamXML())
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
140 self.assertParamExists()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
141 previous = self.host.memory.params.dom.cloneNode(True)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
142 # now check if it is really updated and not duplicated
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
143 self.host.memory.updateParams(self._getParamXML())
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
144 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
145
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
146 self.host.memory.reinit()
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
147 # check successive updates (without intersection)
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
148 self.host.memory.updateParams(self._getParamXML('1'))
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
149 self.assertParamExists("1")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
150 self.assertParamNotExists("2")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
151 self.host.memory.updateParams(self._getParamXML('2'))
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
152 self.assertParamExists("1")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
153 self.assertParamExists("2")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
154
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
155 previous = self.host.memory.params.dom.cloneNode(True) # save for later
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
156
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
157 self.host.memory.reinit()
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
158 # check successive updates (with intersection)
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
159 self.host.memory.updateParams(self._getParamXML('1'))
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
160 self.assertParamExists("1")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
161 self.assertParamNotExists("2")
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
162 self.host.memory.updateParams(self._getParamXML('12'))
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
163 self.assertParamExists("1")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
164 self.assertParamExists("2")
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
165
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
166 # successive updates with or without intersection should have the same result
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
167 self.assertEqual(previous.toxml().encode("utf-8"), self.host.memory.params.dom.toxml().encode("utf-8"))
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
168
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
169 self.host.memory.reinit()
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
170 # one update with two params in a new category
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
171 self.host.memory.updateParams(self._getParamXML('12'))
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
172 self.assertParamExists("1")
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
173 self.assertParamExists("2")
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
174
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
175 def test_getParams(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
176 # tests with no security level on the parameter (most secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
177 params = self._getParamXML()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
178 self.host.memory.reinit()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
179 self.host.memory.updateParams(params)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
180 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
181 self._getParams(0).addCallback(self.assertParamNotExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
182 self._getParams(1).addCallback(self.assertParamNotExists_async)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
183 # tests with security level 0 on the parameter (not secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
184 params = self._getParamXML(security_level=0)
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
185 self.host.memory.reinit()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
186 self.host.memory.updateParams(params)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
187 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
188 self._getParams(0).addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
189 self._getParams(1).addCallback(self.assertParamExists_async)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
190 # tests with security level 1 on the parameter (more secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
191 params = self._getParamXML(security_level=1)
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
192 self.host.memory.reinit()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
193 self.host.memory.updateParams(params)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
194 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
195 self._getParams(0).addCallback(self.assertParamNotExists_async)
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
196 return self._getParams(1).addCallback(self.assertParamExists_async)
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
197
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
198 def test_paramsRegisterApp(self):
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
199
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
200 def register(xml, security_limit, app):
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
201 """
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
202 @param xml: XML definition of the parameters to be added
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
203 @param security_limit: -1 means no security, 0 is the maximum security then the higher the less secure
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
204 @param app: name of the frontend registering the parameters
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
205 """
1909
0681d69cbe0a test: add helpers methods muteLogging and unmuteLogging
souliane <souliane@mailoo.org>
parents: 1766
diff changeset
206 helpers.muteLogging()
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
207 self.host.memory.paramsRegisterApp(xml, security_limit, app)
1909
0681d69cbe0a test: add helpers methods muteLogging and unmuteLogging
souliane <souliane@mailoo.org>
parents: 1766
diff changeset
208 helpers.unmuteLogging()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
209
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
210 # tests with no security level on the parameter (most secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
211 params = self._getParamXML()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
212 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
213 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
214 self.assertParamExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
215 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
216 register(params, 0, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
217 self.assertParamNotExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
218 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
219 register(params, 1, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
220 self.assertParamNotExists()
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
221
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
222 # tests with security level 0 on the parameter (not secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
223 params = self._getParamXML(security_level=0)
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
224 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
225 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
226 self.assertParamExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
227 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
228 register(params, 0, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
229 self.assertParamExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
230 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
231 register(params, 1, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
232 self.assertParamExists()
833
9bac2fc74968 memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents: 811
diff changeset
233
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
234 # tests with security level 1 on the parameter (more secure)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
235 params = self._getParamXML(security_level=1)
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
236 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
237 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
238 self.assertParamExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
239 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
240 register(params, 0, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
241 self.assertParamNotExists()
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
242 self.host.memory.reinit()
793
cb2db0d85029 test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents: 789
diff changeset
243 register(params, 1, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
244 self.assertParamExists()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
245
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
246 # tests with security level 1 and several parameters being registered
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
247 params = self._getParamXML("12", security_level=1)
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
248 self.host.memory.reinit()
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
249 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
250 self.assertParamExists()
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
251 self.assertParamExists("2")
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
252 self.host.memory.reinit()
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
253 register(params, 0, Const.APP_NAME)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
254 self.assertParamNotExists()
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
255 self.assertParamNotExists("2")
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
256 self.host.memory.reinit()
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
257 register(params, 1, Const.APP_NAME)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
258 self.assertParamExists()
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
259 self.assertParamExists("2")
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
260
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
261 # tests with several parameters being registered in an existing category
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
262 self.host.memory.reinit()
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
263 self.host.memory.updateParams(self._getParamXML("3"))
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
264 register(self._getParamXML("12"), Const.NO_SECURITY_LIMIT, Const.APP_NAME)
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
265 self.assertParamExists()
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
266 self.assertParamExists("2")
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
267 self.host.memory.reinit()
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
268
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
269 def test_paramsRegisterApp_getParams(self):
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
270 # test retrieving the parameter for a specific frontend
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
271 self.host.memory.reinit()
782
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
272 params = self._getParamXML(security_level=1)
0e5807193721 test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff changeset
273 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME)
789
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
274 self._getParams(1, '').addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
275 self._getParams(1, Const.APP_NAME).addCallback(self.assertParamExists_async)
0cb423500fbb test: use the SatTestCase methods instead of builtin "assert" in tests for memory, plugin xep-0033
souliane <souliane@mailoo.org>
parents: 786
diff changeset
276 self._getParams(1, 'another_dummy_frontend').addCallback(self.assertParamNotExists_async)
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
277
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
278 # the same with several parameters registered at the same time
1271
2308f8405ffb test: refactoring:
souliane <souliane@mailoo.org>
parents: 1051
diff changeset
279 self.host.memory.reinit()
1051
854880a31717 memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents: 1050
diff changeset
280 params = self._getParamXML('12', security_level=0)
1050
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
281 self.host.memory.paramsRegisterApp(params, 5, Const.APP_NAME)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
282 self._getParams(5, '').addCallback(self.assertParamExists_async)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
283 self._getParams(5, '').addCallback(self.assertParamExists_async, "2")
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
284 self._getParams(5, Const.APP_NAME).addCallback(self.assertParamExists_async)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
285 self._getParams(5, Const.APP_NAME).addCallback(self.assertParamExists_async, "2")
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
286 self._getParams(5, 'another_dummy_frontend').addCallback(self.assertParamNotExists_async)
de415d7984f7 memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents: 997
diff changeset
287 return self._getParams(5, 'another_dummy_frontend').addCallback(self.assertParamNotExists_async, "2")