-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
DOMAIN = 'rpcserver' | ||
|
||
|
||
def test_cf_preferences(client): | ||
if client.preferences.cf.get_keys(DOMAIN) is not None: | ||
# if from some reason this domain already exist, empty it | ||
client.preferences.cf.clear(DOMAIN) | ||
assert client.preferences.cf.get_keys(DOMAIN) is None | ||
|
||
# test set a full dictionary | ||
test_dict = {'KEY1': 'VALUE1', 'KEY2': 'VALUE2'} | ||
client.preferences.cf.set_dict(test_dict, DOMAIN) | ||
assert test_dict == client.preferences.cf.get_values(DOMAIN) | ||
|
||
# test set remove a single value | ||
client.preferences.cf.remove('KEY2', DOMAIN) | ||
test_dict.pop('KEY2') | ||
assert test_dict == client.preferences.cf.get_values(DOMAIN) | ||
|
||
# remove out test data and verify it works | ||
client.preferences.cf.clear(DOMAIN) | ||
assert client.preferences.cf.get_keys(DOMAIN) is None | ||
|
||
|
||
def test_sc_preferences(client): | ||
with client.preferences.sc.get_preferences_object(DOMAIN) as pref: | ||
if pref.to_dict() != {}: | ||
# if from some reason this domain already exist, empty it | ||
pref.clear() | ||
assert pref.to_dict() == {} | ||
|
||
# test set a full dictionary | ||
test_dict = {'KEY1': 'VALUE1', 'KEY2': 'VALUE2'} | ||
pref.set_dict(test_dict) | ||
assert test_dict == pref.to_dict() | ||
|
||
# test set remove a single value | ||
pref.remove('KEY2') | ||
test_dict.pop('KEY2') | ||
assert test_dict == pref.to_dict() | ||
|
||
# remove out test data and verify it works | ||
pref.clear() | ||
assert pref.to_dict() == {} |