Move admin api impl to its own package

It doesn't really belong under rest/client/v1 any more.
This commit is contained in:
Richard van der Hoff 2019-05-01 15:32:38 +01:00
parent 8e9ca83537
commit 40e576e29c
19 changed files with 67 additions and 42 deletions

View file

@ -62,7 +62,7 @@ from synapse.python_dependencies import check_requirements
from synapse.replication.http import REPLICATION_PREFIX, ReplicationRestResource
from synapse.replication.tcp.resource import ReplicationStreamProtocolFactory
from synapse.rest import ClientRestResource
from synapse.rest.client.v1.admin import AdminRestResource
from synapse.rest.admin import AdminRestResource
from synapse.rest.key.v2 import KeyApiV2Resource
from synapse.rest.media.v0.content_repository import ContentRepoResource
from synapse.rest.well_known import WellKnownResource

View file

@ -13,11 +13,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import synapse.rest.admin
from synapse.http.server import JsonResource
from synapse.rest.client import versions
from synapse.rest.client.v1 import (
admin,
directory,
events,
initial_sync,
@ -118,4 +117,4 @@ class ClientRestResource(JsonResource):
account_validity.register_servlets(hs, client_resource)
# moving to /_synapse/admin
admin.register_servlets(hs, client_resource)
synapse.rest.admin.register_servlets(hs, client_resource)

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2018-2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View file

@ -14,8 +14,9 @@
# limitations under the License.
from mock import Mock
import synapse.rest.admin
from synapse.api.constants import UserTypes
from synapse.rest.client.v1 import admin, login, room
from synapse.rest.client.v1 import login, room
from synapse.rest.client.v2_alpha import user_directory
from synapse.storage.roommember import ProfileInfo
@ -29,7 +30,7 @@ class UserDirectoryTestCase(unittest.HomeserverTestCase):
servlets = [
login.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
]
@ -327,7 +328,7 @@ class TestUserDirSearchDisabled(unittest.HomeserverTestCase):
user_directory.register_servlets,
room.register_servlets,
login.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
]
def make_homeserver(self, reactor, clock):

View file

@ -19,7 +19,8 @@ import pkg_resources
from twisted.internet.defer import Deferred
from synapse.rest.client.v1 import admin, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import login, room
from tests.unittest import HomeserverTestCase
@ -33,7 +34,7 @@ class EmailPusherTests(HomeserverTestCase):
skip = "No Jinja installed" if not load_jinja2_templates else None
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
]

View file

@ -17,7 +17,8 @@ from mock import Mock
from twisted.internet.defer import Deferred
from synapse.rest.client.v1 import admin, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import login, room
from synapse.util.logcontext import make_deferred_yieldable
from tests.unittest import HomeserverTestCase
@ -32,7 +33,7 @@ class HTTPPusherTests(HomeserverTestCase):
skip = "No Jinja installed" if not load_jinja2_templates else None
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
]

View file

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

View file

@ -19,8 +19,9 @@ import json
from mock import Mock
import synapse.rest.admin
from synapse.api.constants import UserTypes
from synapse.rest.client.v1 import admin, events, login, room
from synapse.rest.client.v1 import events, login, room
from synapse.rest.client.v2_alpha import groups
from tests import unittest
@ -29,7 +30,7 @@ from tests import unittest
class VersionTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
]
@ -62,7 +63,7 @@ class VersionTestCase(unittest.HomeserverTestCase):
class UserRegisterTestCase(unittest.HomeserverTestCase):
servlets = [admin.register_servlets]
servlets = [synapse.rest.admin.register_servlets]
def make_homeserver(self, reactor, clock):
@ -358,7 +359,7 @@ class UserRegisterTestCase(unittest.HomeserverTestCase):
class ShutdownRoomTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
events.register_servlets,
room.register_servlets,
@ -495,7 +496,7 @@ class ShutdownRoomTestCase(unittest.HomeserverTestCase):
class DeleteGroupTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
groups.register_servlets,
]

View file

@ -15,8 +15,9 @@
import os
import synapse.rest.admin
from synapse.api.urls import ConsentURIBuilder
from synapse.rest.client.v1 import admin, login, room
from synapse.rest.client.v1 import login, room
from synapse.rest.consent import consent_resource
from tests import unittest
@ -31,7 +32,7 @@ except Exception:
class ConsentResourceTestCase(unittest.HomeserverTestCase):
skip = "No Jinja installed" if not load_jinja2_templates else None
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
]

View file

@ -15,7 +15,8 @@
import json
from synapse.rest.client.v1 import admin, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import login, room
from tests import unittest
@ -23,7 +24,7 @@ from tests import unittest
class IdentityTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
]

View file

@ -17,7 +17,8 @@
from mock import Mock, NonCallableMock
from synapse.rest.client.v1 import admin, events, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import events, login, room
from tests import unittest
@ -28,7 +29,7 @@ class EventStreamPermissionsTestCase(unittest.HomeserverTestCase):
servlets = [
events.register_servlets,
room.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
]

View file

@ -1,6 +1,7 @@
import json
from synapse.rest.client.v1 import admin, login
import synapse.rest.admin
from synapse.rest.client.v1 import login
from tests import unittest
@ -10,7 +11,7 @@ LOGIN_URL = b"/_matrix/client/r0/login"
class LoginRestServletTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
]

View file

@ -22,8 +22,9 @@ from six.moves.urllib import parse as urlparse
from twisted.internet import defer
import synapse.rest.admin
from synapse.api.constants import Membership
from synapse.rest.client.v1 import admin, login, room
from synapse.rest.client.v1 import login, room
from tests import unittest
@ -803,7 +804,7 @@ class RoomMessageListTestCase(RoomBase):
class RoomSearchTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
]

View file

@ -16,8 +16,8 @@
from twisted.internet.defer import succeed
import synapse.rest.admin
from synapse.api.constants import LoginType
from synapse.rest.client.v1 import admin
from synapse.rest.client.v2_alpha import auth, register
from tests import unittest
@ -27,7 +27,7 @@ class FallbackAuthTests(unittest.HomeserverTestCase):
servlets = [
auth.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
register.register_servlets,
]
hijack_auth = False

View file

@ -12,9 +12,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import synapse.rest.admin
from synapse.api.room_versions import DEFAULT_ROOM_VERSION, KNOWN_ROOM_VERSIONS
from synapse.rest.client.v1 import admin, login
from synapse.rest.client.v1 import login
from synapse.rest.client.v2_alpha import capabilities
from tests import unittest
@ -23,7 +23,7 @@ from tests import unittest
class CapabilitiesTestCase(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
capabilities.register_servlets,
login.register_servlets,
]

View file

@ -4,10 +4,11 @@ import os
import pkg_resources
import synapse.rest.admin
from synapse.api.constants import LoginType
from synapse.api.errors import Codes
from synapse.appservice import ApplicationService
from synapse.rest.client.v1 import admin, login
from synapse.rest.client.v1 import login
from synapse.rest.client.v2_alpha import account_validity, register, sync
from tests import unittest
@ -198,7 +199,7 @@ class AccountValidityTestCase(unittest.HomeserverTestCase):
servlets = [
register.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
sync.register_servlets,
account_validity.register_servlets,
@ -307,7 +308,7 @@ class AccountValidityRenewalByEmailTestCase(unittest.HomeserverTestCase):
skip = "No Jinja installed" if not load_jinja2_templates else None
servlets = [
register.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
sync.register_servlets,
account_validity.register_servlets,

View file

@ -15,7 +15,8 @@
from mock import Mock
from synapse.rest.client.v1 import admin, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import login, room
from synapse.rest.client.v2_alpha import sync
from tests import unittest
@ -72,7 +73,7 @@ class FilterTestCase(unittest.HomeserverTestCase):
class SyncTypingTests(unittest.HomeserverTestCase):
servlets = [
admin.register_servlets,
synapse.rest.admin.register_servlets,
room.register_servlets,
login.register_servlets,
sync.register_servlets,

View file

@ -12,8 +12,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.rest.client.v1 import admin, login, room
import synapse.rest.admin
from synapse.rest.client.v1 import login, room
from synapse.rest.client.v2_alpha import sync
from tests import unittest
@ -23,7 +23,7 @@ class ConsentNoticesTests(unittest.HomeserverTestCase):
servlets = [
sync.register_servlets,
admin.register_servlets,
synapse.rest.admin.register_servlets,
login.register_servlets,
room.register_servlets,
]

View file

@ -18,8 +18,9 @@ from mock import Mock
from twisted.internet import defer
import synapse.rest.admin
from synapse.http.site import XForwardedForRequest
from synapse.rest.client.v1 import admin, login
from synapse.rest.client.v1 import login
from tests import unittest
@ -205,7 +206,7 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
class ClientIpAuthTestCase(unittest.HomeserverTestCase):
servlets = [admin.register_servlets, login.register_servlets]
servlets = [synapse.rest.admin.register_servlets, login.register_servlets]
def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver()