mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Remove redundant mocking
This commit is contained in:
parent
30fba62108
commit
90cf1eec44
@ -16,8 +16,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from mock import Mock
|
||||
|
||||
import jsonschema
|
||||
|
||||
from twisted.internet import defer
|
||||
@ -28,7 +26,7 @@ from synapse.api.filtering import Filter
|
||||
from synapse.events import make_event_from_dict
|
||||
|
||||
from tests import unittest
|
||||
from tests.utils import DeferredMockCallable, MockHttpResource, setup_test_homeserver
|
||||
from tests.utils import setup_test_homeserver
|
||||
|
||||
user_localpart = "test_user"
|
||||
|
||||
@ -42,21 +40,9 @@ def MockEvent(**kwargs):
|
||||
|
||||
|
||||
class FilteringTestCase(unittest.TestCase):
|
||||
@defer.inlineCallbacks
|
||||
def setUp(self):
|
||||
self.mock_federation_resource = MockHttpResource()
|
||||
|
||||
self.mock_http_client = Mock(spec=[])
|
||||
self.mock_http_client.put_json = DeferredMockCallable()
|
||||
|
||||
hs = yield setup_test_homeserver(
|
||||
self.addCleanup,
|
||||
federation_http_client=self.mock_http_client,
|
||||
keyring=Mock(),
|
||||
)
|
||||
|
||||
hs = setup_test_homeserver(self.addCleanup)
|
||||
self.filtering = hs.get_filtering()
|
||||
|
||||
self.datastore = hs.get_datastore()
|
||||
|
||||
def test_errors_on_invalid_filters(self):
|
||||
|
@ -42,8 +42,6 @@ class DirectoryTestCase(unittest.HomeserverTestCase):
|
||||
self.mock_registry.register_query_handler = register_query_handler
|
||||
|
||||
hs = self.setup_test_homeserver(
|
||||
federation_http_client=None,
|
||||
resource_for_federation=Mock(),
|
||||
federation_client=self.mock_federation,
|
||||
federation_registry=self.mock_registry,
|
||||
)
|
||||
|
@ -44,8 +44,6 @@ class ProfileTestCase(unittest.TestCase):
|
||||
|
||||
hs = yield setup_test_homeserver(
|
||||
self.addCleanup,
|
||||
federation_http_client=None,
|
||||
resource_for_federation=Mock(),
|
||||
federation_client=self.mock_federation,
|
||||
federation_server=Mock(),
|
||||
federation_registry=self.mock_registry,
|
||||
|
@ -14,9 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
from mock import Mock
|
||||
|
||||
from canonicaljson import json
|
||||
|
||||
from twisted.internet import defer
|
||||
@ -30,12 +27,10 @@ from tests.utils import create_room
|
||||
|
||||
|
||||
class RedactionTestCase(unittest.HomeserverTestCase):
|
||||
def make_homeserver(self, reactor, clock):
|
||||
config = self.default_config()
|
||||
def default_config(self):
|
||||
config = super().default_config()
|
||||
config["redaction_retention_period"] = "30d"
|
||||
return self.setup_test_homeserver(
|
||||
resource_for_federation=Mock(), federation_http_client=None, config=config
|
||||
)
|
||||
return config
|
||||
|
||||
def prepare(self, reactor, clock, hs):
|
||||
self.store = hs.get_datastore()
|
||||
|
@ -14,8 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from unittest.mock import Mock
|
||||
|
||||
from synapse.api.constants import Membership
|
||||
from synapse.rest.admin import register_servlets_for_client_rest_resource
|
||||
from synapse.rest.client.v1 import login, room
|
||||
@ -34,12 +32,6 @@ class RoomMemberStoreTestCase(unittest.HomeserverTestCase):
|
||||
room.register_servlets,
|
||||
]
|
||||
|
||||
def make_homeserver(self, reactor, clock):
|
||||
hs = self.setup_test_homeserver(
|
||||
resource_for_federation=Mock(), federation_http_client=None
|
||||
)
|
||||
return hs
|
||||
|
||||
def prepare(self, reactor, clock, hs: TestHomeServer):
|
||||
|
||||
# We can't test the RoomMemberStore on its own without the other event
|
||||
|
Loading…
Reference in New Issue
Block a user