1313# limitations under the License.
1414
1515import os
16+ from http import HTTPStatus
17+
18+ from twisted .test .proto_helpers import MemoryReactor
1619
1720import synapse .rest .admin
1821from synapse .api .urls import ConsentURIBuilder
1922from synapse .rest .client import login , room
2023from synapse .rest .consent import consent_resource
24+ from synapse .server import HomeServer
25+ from synapse .util import Clock
2126
2227from tests import unittest
2328from tests .server import FakeSite , make_request
@@ -32,7 +37,7 @@ class ConsentResourceTestCase(unittest.HomeserverTestCase):
3237 user_id = True
3338 hijack_auth = False
3439
35- def make_homeserver (self , reactor , clock ) :
40+ def make_homeserver (self , reactor : MemoryReactor , clock : Clock ) -> HomeServer :
3641
3742 config = self .default_config ()
3843 config ["form_secret" ] = "123abc"
@@ -56,7 +61,7 @@ def make_homeserver(self, reactor, clock):
5661 hs = self .setup_test_homeserver (config = config )
5762 return hs
5863
59- def test_render_public_consent (self ):
64+ def test_render_public_consent (self ) -> None :
6065 """You can observe the terms form without specifying a user"""
6166 resource = consent_resource .ConsentResource (self .hs )
6267 channel = make_request (
@@ -66,9 +71,9 @@ def test_render_public_consent(self):
6671 "/consent?v=1" ,
6772 shorthand = False ,
6873 )
69- self .assertEqual (channel .code , 200 )
74+ self .assertEqual (channel .code , HTTPStatus . OK )
7075
71- def test_accept_consent (self ):
76+ def test_accept_consent (self ) -> None :
7277 """
7378 A user can use the consent form to accept the terms.
7479 """
@@ -92,7 +97,7 @@ def test_accept_consent(self):
9297 access_token = access_token ,
9398 shorthand = False ,
9499 )
95- self .assertEqual (channel .code , 200 )
100+ self .assertEqual (channel .code , HTTPStatus . OK )
96101
97102 # Get the version from the body, and whether we've consented
98103 version , consented = channel .result ["body" ].decode ("ascii" ).split ("," )
@@ -107,7 +112,7 @@ def test_accept_consent(self):
107112 access_token = access_token ,
108113 shorthand = False ,
109114 )
110- self .assertEqual (channel .code , 200 )
115+ self .assertEqual (channel .code , HTTPStatus . OK )
111116
112117 # Fetch the consent page, to get the consent version -- it should have
113118 # changed
@@ -119,7 +124,7 @@ def test_accept_consent(self):
119124 access_token = access_token ,
120125 shorthand = False ,
121126 )
122- self .assertEqual (channel .code , 200 )
127+ self .assertEqual (channel .code , HTTPStatus . OK )
123128
124129 # Get the version from the body, and check that it's the version we
125130 # agreed to, and that we've consented to it.
0 commit comments