Skip to content

Commit 43aa406

Browse files
committed
dev: appcfg/pref - key cannot be empty
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
1 parent 8e95cae commit 43aa406

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

tests/appconfig_preferences_ex_test.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@
99
pytest.skip("app_ecosystem_v2 is not installed.", allow_module_level=True)
1010

1111

12+
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
13+
def test_cfg_ex_set_empty_key(class_to_test):
14+
with pytest.raises(NextcloudException):
15+
class_to_test.set("", "some value")
16+
17+
1218
@pytest.mark.parametrize("value", ("0", "1", "12 3", ""))
1319
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
14-
def test_preferences_ex_set_delete(value, class_to_test):
20+
def test_cfg_ex_set_delete(value, class_to_test):
1521
class_to_test.delete("test_key")
1622
assert class_to_test.get_value("test_key") is None
1723
class_to_test.set("test_key", value)
@@ -23,15 +29,7 @@ def test_preferences_ex_set_delete(value, class_to_test):
2329

2430

2531
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
26-
def test_preferences_ex_set_empty_param(class_to_test):
27-
class_to_test.set("", "123")
28-
assert class_to_test.get_value("") == "123"
29-
class_to_test.delete("")
30-
assert class_to_test.get_value("") is None
31-
32-
33-
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
34-
def test_preferences_ex_delete(class_to_test):
32+
def test_cfg_ex_delete(class_to_test):
3533
class_to_test.set("test_key", "123")
3634
assert class_to_test.get_value("test_key")
3735
class_to_test.delete("test_key")
@@ -42,7 +40,7 @@ def test_preferences_ex_delete(class_to_test):
4240

4341

4442
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
45-
def test_preferences_ex_multiply_delete(class_to_test):
43+
def test_cfg_ex_multiply_delete(class_to_test):
4644
class_to_test.set("test_key", "123")
4745
class_to_test.set("test_key2", "123")
4846
assert len(class_to_test.get_values(["test_key", "test_key2"])) == 2
@@ -55,9 +53,9 @@ def test_preferences_ex_multiply_delete(class_to_test):
5553
assert len(class_to_test.get_values(["test_key", "test_key2"])) == 0
5654

5755

58-
@pytest.mark.parametrize("key", ("k", "k y", "", " "))
56+
@pytest.mark.parametrize("key", ("k", "k y", " "))
5957
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
60-
def test_preferences_ex_get_non_existing(key, class_to_test):
58+
def test_cfg_ex_get_non_existing(key, class_to_test):
6159
try:
6260
class_to_test.delete(key)
6361
except NextcloudException:
@@ -68,7 +66,7 @@ def test_preferences_ex_get_non_existing(key, class_to_test):
6866

6967

7068
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
71-
def test_preferences_ex_get(class_to_test):
69+
def test_cfg_ex_get(class_to_test):
7270
class_to_test.delete(["test key", "test key2"])
7371
assert len(class_to_test.get_values(["test key", "test key2"])) == 0
7472
class_to_test.set("test key", "123")
@@ -79,7 +77,7 @@ def test_preferences_ex_get(class_to_test):
7977

8078

8179
@pytest.mark.parametrize("class_to_test", (NC_APP.appconfig_ex_api, NC_APP.preferences_ex_api))
82-
def test_preferences_ex_get_typing(class_to_test):
80+
def test_cfg_ex_get_typing(class_to_test):
8381
class_to_test.set("test key", "123")
8482
class_to_test.set("test key2", "321")
8583
r = class_to_test.get_values(["test key", "test key2"])

0 commit comments

Comments
 (0)