22
33from nc_py_api import NextcloudException
44
5- from gfixture import NC_TO_TEST
6- NC_APP = NC_TO_TEST [1 ] if len (NC_TO_TEST ) > 1 else None
5+ from gfixture import NC_APP
76
87
98if NC_APP is None or "app_ecosystem_v2" not in NC_APP .capabilities :
109 pytest .skip ("app_ecosystem_v2 is not installed." , allow_module_level = True )
1110
1211
13- @pytest .mark .parametrize ("value" , ("0" , "1" , "12 3" , "" ))
1412@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
15- def test_preferences_ex_set_delete (value , class_to_test ):
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+
18+ # @pytest.mark.parametrize("value", ("0", "1", "12 3", ""))
19+ @pytest .mark .parametrize ("value" , ("0" , "1" , "12 3" ))
20+ @pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
21+ def test_cfg_ex_set_delete (value , class_to_test ):
1622 class_to_test .delete ("test_key" )
1723 assert class_to_test .get_value ("test_key" ) is None
1824 class_to_test .set ("test_key" , value )
@@ -24,15 +30,7 @@ def test_preferences_ex_set_delete(value, class_to_test):
2430
2531
2632@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
27- def test_preferences_ex_set_empty_param (class_to_test ):
28- class_to_test .set ("" , "123" )
29- assert class_to_test .get_value ("" ) == "123"
30- class_to_test .delete ("" )
31- assert class_to_test .get_value ("" ) is None
32-
33-
34- @pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
35- def test_preferences_ex_delete (class_to_test ):
33+ def test_cfg_ex_delete (class_to_test ):
3634 class_to_test .set ("test_key" , "123" )
3735 assert class_to_test .get_value ("test_key" )
3836 class_to_test .delete ("test_key" )
@@ -43,7 +41,7 @@ def test_preferences_ex_delete(class_to_test):
4341
4442
4543@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
46- def test_preferences_ex_multiply_delete (class_to_test ):
44+ def test_cfg_ex_multiply_delete (class_to_test ):
4745 class_to_test .set ("test_key" , "123" )
4846 class_to_test .set ("test_key2" , "123" )
4947 assert len (class_to_test .get_values (["test_key" , "test_key2" ])) == 2
@@ -56,9 +54,9 @@ def test_preferences_ex_multiply_delete(class_to_test):
5654 assert len (class_to_test .get_values (["test_key" , "test_key2" ])) == 0
5755
5856
59- @pytest .mark .parametrize ("key" , ("k" , "k y" , "" , " " ))
57+ @pytest .mark .parametrize ("key" , ("k" , "k y" , " " ))
6058@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
61- def test_preferences_ex_get_non_existing (key , class_to_test ):
59+ def test_cfg_ex_get_non_existing (key , class_to_test ):
6260 try :
6361 class_to_test .delete (key )
6462 except NextcloudException :
@@ -69,7 +67,7 @@ def test_preferences_ex_get_non_existing(key, class_to_test):
6967
7068
7169@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
72- def test_preferences_ex_get (class_to_test ):
70+ def test_cfg_ex_get (class_to_test ):
7371 class_to_test .delete (["test key" , "test key2" ])
7472 assert len (class_to_test .get_values (["test key" , "test key2" ])) == 0
7573 class_to_test .set ("test key" , "123" )
@@ -80,7 +78,7 @@ def test_preferences_ex_get(class_to_test):
8078
8179
8280@pytest .mark .parametrize ("class_to_test" , (NC_APP .appconfig_ex_api , NC_APP .preferences_ex_api ))
83- def test_preferences_ex_get_typing (class_to_test ):
81+ def test_cfg_ex_get_typing (class_to_test ):
8482 class_to_test .set ("test key" , "123" )
8583 class_to_test .set ("test key2" , "321" )
8684 r = class_to_test .get_values (["test key" , "test key2" ])
0 commit comments