This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
d721bf6
commit c5b91b4
Showing
9 changed files
with
29 additions
and
36 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
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
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 |
---|---|---|
|
@@ -12,16 +12,14 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import json | ||
from http import HTTPStatus | ||
|
||
from twisted.test.proto_helpers import MemoryReactor | ||
from unittest.mock import Mock | ||
|
||
from twisted.internet import defer | ||
from twisted.test.proto_helpers import MemoryReactor | ||
|
||
import synapse.rest.admin | ||
from synapse.rest.client import login, room | ||
from synapse.rest.client import account, login, room | ||
from synapse.server import HomeServer | ||
from synapse.util import Clock | ||
|
||
|
@@ -47,11 +45,11 @@ def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: | |
|
||
return self.hs | ||
|
||
def prepare(self, reactor, clock, hs): | ||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: | ||
self.user_id = self.register_user("kermit", "monkey") | ||
self.tok = self.login("kermit", "monkey") | ||
|
||
def test_3pid_invite_disabled(self): | ||
def test_3pid_invite_disabled(self) -> None: | ||
channel = self.make_request(b"POST", "/createRoom", {}, access_token=self.tok) | ||
self.assertEquals(channel.result["code"], b"200", channel.result) | ||
room_id = channel.json_body["room_id"] | ||
|
@@ -75,7 +73,7 @@ def test_3pid_lookup_disabled(self) -> None: | |
channel = self.make_request("GET", url, access_token=self.tok) | ||
self.assertEqual(channel.result["code"], b"403", channel.result) | ||
|
||
def test_3pid_bulk_lookup_disabled(self): | ||
def test_3pid_bulk_lookup_disabled(self) -> None: | ||
url = "/_matrix/client/unstable/account/3pid/bulk_lookup" | ||
data = { | ||
"id_server": "testis", | ||
|
@@ -95,7 +93,7 @@ class IdentityEnabledTestCase(unittest.HomeserverTestCase): | |
login.register_servlets, | ||
] | ||
|
||
def make_homeserver(self, reactor, clock): | ||
def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer: | ||
|
||
config = self.default_config() | ||
config["enable_3pid_lookup"] = True | ||
|
@@ -116,12 +114,14 @@ def make_homeserver(self, reactor, clock): | |
|
||
return self.hs | ||
|
||
def prepare(self, reactor, clock, hs): | ||
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: | ||
self.user_id = self.register_user("kermit", "monkey") | ||
self.tok = self.login("kermit", "monkey") | ||
|
||
def test_3pid_invite_enabled(self): | ||
channel = self.make_request(b"POST", "/createRoom", b"{}", access_token=tok) | ||
def test_3pid_invite_enabled(self) -> None: | ||
channel = self.make_request( | ||
b"POST", "/createRoom", b"{}", access_token=self.tok | ||
) | ||
self.assertEqual(channel.code, HTTPStatus.OK, channel.result) | ||
room_id = channel.json_body["room_id"] | ||
|
||
|
@@ -140,7 +140,7 @@ def test_3pid_invite_enabled(self): | |
) | ||
self.assertEquals(channel.result["code"], b"200", channel.result) | ||
|
||
def test_3pid_lookup_enabled(self): | ||
def test_3pid_lookup_enabled(self) -> None: | ||
url = ( | ||
"/_matrix/client/unstable/account/3pid/lookup" | ||
"?id_server=testis&medium=email&[email protected]" | ||
|
@@ -153,7 +153,7 @@ def test_3pid_lookup_enabled(self): | |
{"address": "[email protected]", "medium": "email"}, | ||
) | ||
|
||
def test_3pid_bulk_lookup_enabled(self): | ||
def test_3pid_bulk_lookup_enabled(self) -> None: | ||
url = "/_matrix/client/unstable/account/3pid/bulk_lookup" | ||
data = { | ||
"id_server": "testis", | ||
|
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