Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_: updated profile tests #6061

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions tests-functional/tests/test_wakuext_profile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import random

import pytest
import logging

from test_cases import StatusBackendTestCase


class TestProfile(StatusBackendTestCase):

@pytest.mark.parametrize(
"method, params",
[
Expand All @@ -18,14 +18,37 @@ class TestProfile(StatusBackendTestCase):
("wakuext_setSyncingOnMobileNetwork", [{"enabled": False}]),
("wakuext_togglePeerSyncing", [{"enabled": True}]),
("wakuext_backupData", []),
("settings_saveSetting", ["messages-from-contacts-only", True]),

# these settings are not shown sometimes in settings_getSettings
("settings_saveSetting", ["notifications-enabled?", True]),
("settings_saveSetting", ["send-status-updates?", True]),
("settings_saveSetting", ["preview-privacy?", False]),
("settings_saveSetting", ["currency", "eth"]),
("settings_saveSetting", ["default-sync-period", 259200]),
("settings_saveSetting", ["show-community-asset-when-sending-tokens?", False]),
("settings_saveSetting", ["url-unfurling-mode", 0]),
],
)
def test_(self, method, params):
_id = str(random.randint(1, 8888))
self.rpc_client.rpc_valid_request(method, params, _id)

@pytest.mark.parametrize(
"setting_name, default_value, changed_value",
[
("currency", "usd", "eth"),
("messages-from-contacts-only", False, True),
("preview-privacy?", False, True),
("default-sync-period", 777600, 259200),
("appearance", 0, 1),
("profile-pictures-show-to", 2, 1), #obsolate from v1
("profile-pictures-visibility", 2, 1), #obsolate from v1
],
)
def test_settings_saveSetting(self, setting_name, default_value, changed_value):
_id = str(random.randint(1, 8888))

logging.info("Step: check that %s is %s by default " % (setting_name, default_value))
response = self.rpc_client.rpc_valid_request("settings_getSettings", [])
assert response.json()["result"][setting_name] == default_value

logging.info("Step: change %s to %s and check it is updated" % (setting_name, changed_value))
self.rpc_client.rpc_valid_request('settings_saveSetting', [setting_name, changed_value], _id)
response = self.rpc_client.rpc_valid_request("settings_getSettings", [])
assert response.json()["result"][setting_name] == changed_value