@@ -330,15 +330,16 @@ def test_register_mau_limit_reached(self):
330330 """
331331 handler = self .hs .get_registration_handler ()
332332 store = self .hs .get_datastore ()
333+ auth_blocking = self .hs .get_auth ()._auth_blocking
333334
334335 # Configure MAU limit
335- self . hs . config . limit_usage_by_mau = True
336- self . hs . config . max_mau_value = 2
337- self . hs . config . mau_trial_days = 0
336+ auth_blocking . _limit_usage_by_mau = True
337+ auth_blocking . _max_mau_value = 2
338+ auth_blocking . _mau_trial_days = 0
338339
339340 # Set monthly active users to the limit
340341 store .get_monthly_active_count = Mock (
341- return_value = defer .succeed (self . hs . config . max_mau_value )
342+ return_value = defer .succeed (auth_blocking . _max_mau_value )
342343 )
343344 # The registration of a new user fails due to the limit
344345 self .get_failure (
@@ -577,11 +578,12 @@ def test_create_user_mau_limit_reached_active_admin(self):
577578 self .hs .config .registration_shared_secret = None
578579
579580 handler = self .hs .get_registration_handler ()
581+ auth_blocking = self .hs .get_auth ()._auth_blocking
580582
581583 # Configure MAU limit
582- self . hs . config . limit_usage_by_mau = True
583- self . hs . config . max_mau_value = 2
584- self . hs . config . mau_trial_days = 0
584+ auth_blocking . _limit_usage_by_mau = True
585+ auth_blocking . _max_mau_value = 2
586+ auth_blocking . _mau_trial_days = 0
585587
586588 # Sync to set admin user to active
587589 # before limit of monthly active users is reached
@@ -597,7 +599,7 @@ def test_create_user_mau_limit_reached_active_admin(self):
597599
598600 # Set monthly active users to the limit
599601 self .store .get_monthly_active_count = Mock (
600- return_value = defer .succeed (self . hs . config . max_mau_value )
602+ return_value = defer .succeed (auth_blocking . _max_mau_value )
601603 )
602604 # The registration of a new user fails due to the limit
603605 self .get_failure (
@@ -625,20 +627,21 @@ def test_create_user_mau_limit_reached_active_admin(self):
625627 def test_create_user_mau_limit_reached_passiv_admin (self ):
626628 """
627629 Try to create a new regular user if MAU limit is reached.
628- Admin user was not active before creating user and creation fails .
630+ Admin user was not active before creating user.
629631 """
630632 self .hs .config .registration_shared_secret = None
631633
632634 handler = self .hs .get_registration_handler ()
635+ auth_blocking = self .hs .get_auth ()._auth_blocking
633636
634637 # Configure MAU limit
635- self . hs . config . limit_usage_by_mau = True
636- self . hs . config . max_mau_value = 2
637- self . hs . config . mau_trial_days = 0
638+ auth_blocking . _limit_usage_by_mau = True
639+ auth_blocking . _max_mau_value = 2
640+ auth_blocking . _mau_trial_days = 0
638641
639642 # Set monthly active users to the limit
640643 self .store .get_monthly_active_count = Mock (
641- return_value = defer .succeed (self . hs . config . max_mau_value )
644+ return_value = defer .succeed (auth_blocking . _max_mau_value )
642645 )
643646 # The registration of a new user fails due to the limit
644647 self .get_failure (
@@ -659,7 +662,10 @@ def test_create_user_mau_limit_reached_passiv_admin(self):
659662 )
660663 self .render (request )
661664
662- self .assertEqual (500 , int (channel .result ["code" ]), msg = channel .result ["body" ])
665+ # Admin user is not blocked by mau anymore
666+ self .assertEqual (201 , int (channel .result ["code" ]), msg = channel .result ["body" ])
667+ self .assertEqual ("@bob:test" , channel .json_body ["name" ])
668+ self .assertEqual (False , channel .json_body ["admin" ])
663669
664670 def test_set_password (self ):
665671 """
0 commit comments