Mercurial > libervia-backend
comparison tests/unit/conftest.py @ 4232:0fbe5c605eb6
tests (unit/webrtc,XEP-0176, XEP-0234): Fix tests and add webrtc file transfer tests:
fix 441
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 06 Apr 2024 12:59:50 +0200 |
parents | 7c5654c54fed |
children | f1d0cde61af7 |
comparison
equal
deleted
inserted
replaced
4231:e11b13418ba6 | 4232:0fbe5c605eb6 |
---|---|
37 @fixture(scope="session") | 37 @fixture(scope="session") |
38 def storage(): | 38 def storage(): |
39 return AsyncMock() | 39 return AsyncMock() |
40 | 40 |
41 | 41 |
42 class MockSAT(LiberviaBackend): | 42 class MockLiberviaBackend(LiberviaBackend): |
43 | 43 |
44 def __init__(self, bridge, storage): | 44 def __init__(self, bridge, storage): |
45 self._cb_map = {} | 45 self._cb_map = {} |
46 self._menus = {} | 46 self._menus = {} |
47 self._menus_paths = {} | 47 self._menus_paths = {} |
74 self._test_config[(section or None, name)] = value | 74 self._test_config[(section or None, name)] = value |
75 | 75 |
76 def clear_test_config(self): | 76 def clear_test_config(self): |
77 self._test_config.clear() | 77 self._test_config.clear() |
78 | 78 |
79 def register_namespace(self, short_name, namespace): | |
80 # Plugin classes may be instantiated several times in tests, so we do nothing in | |
81 # this method to avoid ConflictError. | |
82 pass | |
83 | |
79 @contextmanager | 84 @contextmanager |
80 def use_option_and_reload(self, section, name, value): | 85 def use_option_and_reload(self, section, name, value): |
81 self.set_test_config(section, name, value) | 86 self.set_test_config(section, name, value) |
82 self.reload_plugins() | 87 self.reload_plugins() |
83 try: | 88 try: |
102 pass | 107 pass |
103 | 108 |
104 | 109 |
105 @fixture(scope="session") | 110 @fixture(scope="session") |
106 def host(bridge, storage): | 111 def host(bridge, storage): |
107 host = MockSAT(bridge=bridge, storage=storage) | 112 host = MockLiberviaBackend(bridge=bridge, storage=storage) |
108 return host | 113 return host |
109 | 114 |
110 | 115 |
111 @fixture | 116 @fixture |
112 def client(): | 117 def client(): |