Mercurial > libervia-backend
annotate libervia/backend/test/test_memory.py @ 4249:ba46d6a0ff3a
doc: style/typos/URL fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 31 May 2024 11:08:20 +0200 |
parents | 4b842c1fb686 |
children | 0d7bb4df2343 |
rev | line source |
---|---|
3028 | 1 #!/usr/bin/env python3 |
3137 | 2 |
782
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 |
3479 | 5 # Copyright (C) 2009-2021 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 |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4037
diff
changeset
|
20 from libervia.backend.core.i18n import _ |
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4037
diff
changeset
|
21 from libervia.backend.test import helpers |
782
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 |
3028 | 24 from .constants import Const |
782
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 def setUp(self): |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
30 self.host = helpers.FakeSAT() |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
31 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
32 def _get_param_xml(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
|
33 """Generate XML for testing parameters |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
34 |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
35 @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
|
36 @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
|
37 @return (str) |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
38 """ |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
39 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
40 def get_param(name): |
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
|
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/> |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
43 """ % { |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
44 "param_name": name, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
45 "param_label": _(name), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
46 "security": "" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
47 if security_level is None |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
48 else ('security="%d"' % security_level), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
49 } |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
50 |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
51 params = "" |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
52 if "1" in param: |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
53 params += get_param(Const.ENABLE_UNIBOX_PARAM) |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
54 if "2" in param: |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
55 params += get_param(Const.PARAM_IN_QUOTES) |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
56 if "3" in param: |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
57 params += get_param("Dummy param") |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 return """ |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
59 <params> |
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 <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
|
62 %(params)s |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
63 </category> |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
64 </individual> |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
65 </params> |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
66 """ % { |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
67 "category_name": Const.COMPOSITION_KEY, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
68 "category_label": _(Const.COMPOSITION_KEY), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
69 "params": params, |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 } |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
72 def _param_exists(self, param="1", src=None): |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
73 """ |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
74 |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
75 @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
|
76 @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
|
77 @return: True is the param exists |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
78 """ |
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
|
79 if param == "1": |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 category = Const.COMPOSITION_KEY |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
84 if src is None: |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 src = self.host.memory.params.dom.documentElement |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 for type_node in src.childNodes: |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
87 # 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
|
88 # some "individual" or "general" elements, when it comes |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
89 # from Memory.get_params we have here a "params" elements |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
90 if type_node.nodeName not in ("individual", "general", "params"): |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
91 continue |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
92 for cat_node in type_node.childNodes: |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
93 if ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
94 cat_node.nodeName != "category" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
95 or cat_node.getAttribute("name") != category |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
96 ): |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
97 continue |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
98 for param in cat_node.childNodes: |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
99 if param.nodeName == "param" and param.getAttribute("name") == name: |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
100 return True |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
101 return False |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
102 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
103 def assert_param_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
|
104 """ |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
105 @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
|
106 @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
|
107 @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
|
108 @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
|
109 """ |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
110 msg = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
111 "Expected parameter not found!\n" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
112 if exists |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
113 else "Unexpected parameter found!\n" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
114 ) |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
115 if deferred: |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
116 # 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
|
117 # 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
|
118 msg += "\n".join(traceback.format_stack(limit=5 if exists else 6)) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
119 assertion = self._param_exists(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
|
120 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
|
121 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
122 def assert_param_exists(self, param="1", src=None): |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
123 self.assert_param_generic(param, src, True) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
125 def assert_param_not_exists(self, param="1", src=None): |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
126 self.assert_param_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
|
127 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
128 def assert_param_exists_async(self, src, param="1"): |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
129 """@param src: a deferred result from Memory.get_params""" |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
130 self.assert_param_generic( |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
131 param, minidom.parseString(src.encode("utf-8")), True, True |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
132 ) |
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
|
133 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
134 def assert_param_not_exists_async(self, src, param="1"): |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
135 """@param src: a deferred result from Memory.get_params""" |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
136 self.assert_param_generic( |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
137 param, minidom.parseString(src.encode("utf-8")), False, True |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
138 ) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
139 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
140 def _get_params(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
|
141 """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
|
142 |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
143 @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
|
144 @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
|
145 @param profile_key |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
146 """ |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
147 if profile_key == "@NONE@": |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
148 profile_key = "@DEFAULT@" |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
149 return self.host.memory.params.get_params(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
|
150 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
151 def test_update_params(self): |
1271 | 152 self.host.memory.reinit() |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
153 # check if the update works |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
154 self.host.memory.update_params(self._get_param_xml()) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
155 self.assert_param_exists() |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
156 previous = self.host.memory.params.dom.cloneNode(True) |
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
157 # now check if it is really updated and not duplicated |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
158 self.host.memory.update_params(self._get_param_xml()) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
159 self.assertEqual( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
160 previous.toxml().encode("utf-8"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
161 self.host.memory.params.dom.toxml().encode("utf-8"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
162 ) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
163 |
1271 | 164 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
|
165 # check successive updates (without intersection) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
166 self.host.memory.update_params(self._get_param_xml("1")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
167 self.assert_param_exists("1") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
168 self.assert_param_not_exists("2") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
169 self.host.memory.update_params(self._get_param_xml("2")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
170 self.assert_param_exists("1") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
171 self.assert_param_exists("2") |
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
|
172 |
9bac2fc74968
memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
173 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
|
174 |
1271 | 175 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
|
176 # check successive updates (with intersection) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
177 self.host.memory.update_params(self._get_param_xml("1")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
178 self.assert_param_exists("1") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
179 self.assert_param_not_exists("2") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
180 self.host.memory.update_params(self._get_param_xml("12")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
181 self.assert_param_exists("1") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
182 self.assert_param_exists("2") |
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
|
183 |
9bac2fc74968
memory: bug fix to not register twice frontends parameters + added some tests for param update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
184 # successive updates with or without intersection should have the same result |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
185 self.assertEqual( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
186 previous.toxml().encode("utf-8"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
187 self.host.memory.params.dom.toxml().encode("utf-8"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
188 ) |
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
|
189 |
1271 | 190 self.host.memory.reinit() |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
191 # one update with two params in a new category |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
192 self.host.memory.update_params(self._get_param_xml("12")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
193 self.assert_param_exists("1") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
194 self.assert_param_exists("2") |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
195 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
196 def test_get_params(self): |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
197 # tests with no security level on the parameter (most secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
198 params = self._get_param_xml() |
1271 | 199 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
200 self.host.memory.update_params(params) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
201 self._get_params(Const.NO_SECURITY_LIMIT).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
202 self._get_params(0).addCallback(self.assert_param_not_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
203 self._get_params(1).addCallback(self.assert_param_not_exists_async) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
204 # tests with security level 0 on the parameter (not secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
205 params = self._get_param_xml(security_level=0) |
1271 | 206 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
207 self.host.memory.update_params(params) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
208 self._get_params(Const.NO_SECURITY_LIMIT).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
209 self._get_params(0).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
210 self._get_params(1).addCallback(self.assert_param_exists_async) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
211 # tests with security level 1 on the parameter (more secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
212 params = self._get_param_xml(security_level=1) |
1271 | 213 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
214 self.host.memory.update_params(params) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
215 self._get_params(Const.NO_SECURITY_LIMIT).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
216 self._get_params(0).addCallback(self.assert_param_not_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
217 return self._get_params(1).addCallback(self.assert_param_exists_async) |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
218 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
219 def test_params_register_app(self): |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
220 def register(xml, security_limit, app): |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
221 """ |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
222 @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
|
223 @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
|
224 @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
|
225 """ |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
226 helpers.mute_logging() |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
227 self.host.memory.params_register_app(xml, security_limit, app) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
228 helpers.unmute_logging() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
229 |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
230 # tests with no security level on the parameter (most secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
231 params = self._get_param_xml() |
1271 | 232 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
233 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
234 self.assert_param_exists() |
1271 | 235 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
236 register(params, 0, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
237 self.assert_param_not_exists() |
1271 | 238 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
239 register(params, 1, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
240 self.assert_param_not_exists() |
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
|
241 |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
242 # tests with security level 0 on the parameter (not secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
243 params = self._get_param_xml(security_level=0) |
1271 | 244 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
245 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
246 self.assert_param_exists() |
1271 | 247 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
248 register(params, 0, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
249 self.assert_param_exists() |
1271 | 250 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
251 register(params, 1, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
252 self.assert_param_exists() |
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
|
253 |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
254 # tests with security level 1 on the parameter (more secure) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
255 params = self._get_param_xml(security_level=1) |
1271 | 256 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
257 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
258 self.assert_param_exists() |
1271 | 259 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
260 register(params, 0, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
261 self.assert_param_not_exists() |
1271 | 262 self.host.memory.reinit() |
793
cb2db0d85029
test: silent info/warning that were polluting the output
souliane <souliane@mailoo.org>
parents:
789
diff
changeset
|
263 register(params, 1, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
264 self.assert_param_exists() |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
265 |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
266 # tests with security level 1 and several parameters being registered |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
267 params = self._get_param_xml("12", security_level=1) |
1271 | 268 self.host.memory.reinit() |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
269 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
270 self.assert_param_exists() |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
271 self.assert_param_exists("2") |
1271 | 272 self.host.memory.reinit() |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
273 register(params, 0, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
274 self.assert_param_not_exists() |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
275 self.assert_param_not_exists("2") |
1271 | 276 self.host.memory.reinit() |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
277 register(params, 1, Const.APP_NAME) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
278 self.assert_param_exists() |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
279 self.assert_param_exists("2") |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
280 |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
281 # tests with several parameters being registered in an existing category |
1271 | 282 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
283 self.host.memory.update_params(self._get_param_xml("3")) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
284 register(self._get_param_xml("12"), Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
285 self.assert_param_exists() |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
286 self.assert_param_exists("2") |
1271 | 287 self.host.memory.reinit() |
1051
854880a31717
memory (params), test: fixes updateParams bug
souliane <souliane@mailoo.org>
parents:
1050
diff
changeset
|
288 |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
289 def test_params_register_app_get_params(self): |
782
0e5807193721
test: added some tests for Memory
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
290 # test retrieving the parameter for a specific frontend |
1271 | 291 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
292 params = self._get_param_xml(security_level=1) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
293 self.host.memory.params_register_app(params, 1, Const.APP_NAME) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
294 self._get_params(1, "").addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
295 self._get_params(1, Const.APP_NAME).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
296 self._get_params(1, "another_dummy_frontend").addCallback( |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
297 self.assert_param_not_exists_async |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
298 ) |
1050
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
299 |
de415d7984f7
memory (params), test: fixes bug relative to parameter filtering
souliane <souliane@mailoo.org>
parents:
997
diff
changeset
|
300 # the same with several parameters registered at the same time |
1271 | 301 self.host.memory.reinit() |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
302 params = self._get_param_xml("12", security_level=0) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
303 self.host.memory.params_register_app(params, 5, Const.APP_NAME) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
304 self._get_params(5, "").addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
305 self._get_params(5, "").addCallback(self.assert_param_exists_async, "2") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
306 self._get_params(5, Const.APP_NAME).addCallback(self.assert_param_exists_async) |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
307 self._get_params(5, Const.APP_NAME).addCallback(self.assert_param_exists_async, "2") |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
308 self._get_params(5, "another_dummy_frontend").addCallback( |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
309 self.assert_param_not_exists_async |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
310 ) |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
311 return self._get_params(5, "another_dummy_frontend").addCallback( |
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3479
diff
changeset
|
312 self.assert_param_not_exists_async, "2" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
313 ) |