fix tests
This commit is contained in:
@@ -145,10 +145,10 @@ class MonthlyActiveUsersStore(SQLBaseStore):
|
||||
sql = """
|
||||
SELECT COALESCE(count(*), 0)
|
||||
FROM monthly_active_users
|
||||
WHERE timestamp - last_active > ?
|
||||
WHERE timestamp - first_active >= ?
|
||||
"""
|
||||
|
||||
txn.execute(sql, mau_trial_ms)
|
||||
txn.execute(sql, (mau_trial_ms,))
|
||||
count, = txn.fetchone()
|
||||
return count
|
||||
return self.runInteraction("count_users", _count_users)
|
||||
|
||||
@@ -41,6 +41,7 @@ class AuthTestCase(unittest.TestCase):
|
||||
self.macaroon_generator = self.hs.get_macaroon_generator()
|
||||
# MAU tests
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
self.small_number_of_users = 1
|
||||
self.large_number_of_users = 100
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class RegistrationTestCase(unittest.TestCase):
|
||||
self.handler = self.hs.get_handlers().registration_handler
|
||||
self.store = self.hs.get_datastore()
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
self.lots_of_users = 100
|
||||
self.small_number_of_users = 1
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ class SyncTestCase(tests.unittest.TestCase):
|
||||
|
||||
self.hs.config.limit_usage_by_mau = True
|
||||
self.hs.config.max_mau_value = 1
|
||||
self.hs.config.mau_trial_days = 0
|
||||
|
||||
# Check that the happy case does not throw errors
|
||||
yield self.store.upsert_monthly_active_user(user_id1)
|
||||
|
||||
@@ -59,6 +59,7 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
|
||||
def test_disabled_monthly_active_user(self):
|
||||
self.hs.config.limit_usage_by_mau = False
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
user_id = "@user:server"
|
||||
yield self.store.insert_client_ip(
|
||||
user_id, "access_token", "ip", "user_agent", "device_id"
|
||||
@@ -70,6 +71,7 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
|
||||
def test_adding_monthly_active_user_when_full(self):
|
||||
self.hs.config.limit_usage_by_mau = True
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
lots_of_users = 100
|
||||
user_id = "@user:server"
|
||||
|
||||
@@ -86,6 +88,7 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
|
||||
def test_adding_monthly_active_user_when_space(self):
|
||||
self.hs.config.limit_usage_by_mau = True
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
user_id = "@user:server"
|
||||
active = yield self.store.user_last_seen_monthly_active(user_id)
|
||||
self.assertFalse(active)
|
||||
@@ -100,6 +103,7 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
|
||||
def test_updating_monthly_active_user_when_space(self):
|
||||
self.hs.config.limit_usage_by_mau = True
|
||||
self.hs.config.max_mau_value = 50
|
||||
self.hs.config.mau_trial_days = 0
|
||||
user_id = "@user:server"
|
||||
|
||||
active = yield self.store.user_last_seen_monthly_active(user_id)
|
||||
|
||||
@@ -30,6 +30,8 @@ class MonthlyActiveUsersTestCase(tests.unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.hs = yield setup_test_homeserver(self.addCleanup)
|
||||
self.store = self.hs.get_datastore()
|
||||
self.hs.config.max_mau_value = 2
|
||||
self.hs.config.mau_trial_days = 0
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def test_initialise_reserved_users(self):
|
||||
|
||||
Reference in New Issue
Block a user