diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-08-22 19:13:06 +0200 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-08-22 19:13:06 +0200 |
commit | f12bb11797778ec042d40372d3cdf2dbd5540ce2 (patch) | |
tree | d70c09fee8d1010a428b0ebffad9b300eabb4385 | |
parent | add default for first_active column (diff) | |
download | synapse-f12bb11797778ec042d40372d3cdf2dbd5540ce2.tar.xz |
fix tests
-rw-r--r-- | synapse/storage/monthly_active_users.py | 4 | ||||
-rw-r--r-- | tests/handlers/test_auth.py | 1 | ||||
-rw-r--r-- | tests/handlers/test_register.py | 1 | ||||
-rw-r--r-- | tests/handlers/test_sync.py | 1 | ||||
-rw-r--r-- | tests/storage/test_client_ips.py | 4 | ||||
-rw-r--r-- | tests/storage/test_monthly_active_users.py | 2 |
6 files changed, 11 insertions, 2 deletions
diff --git a/synapse/storage/monthly_active_users.py b/synapse/storage/monthly_active_users.py index fa985bc005..03526ce1e3 100644 --- a/synapse/storage/monthly_active_users.py +++ b/synapse/storage/monthly_active_users.py @@ -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) diff --git a/tests/handlers/test_auth.py b/tests/handlers/test_auth.py index 1e39fe0ec2..88eb50237f 100644 --- a/tests/handlers/test_auth.py +++ b/tests/handlers/test_auth.py @@ -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 diff --git a/tests/handlers/test_register.py b/tests/handlers/test_register.py index 7b4ade3dfb..81947820a1 100644 --- a/tests/handlers/test_register.py +++ b/tests/handlers/test_register.py @@ -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 diff --git a/tests/handlers/test_sync.py b/tests/handlers/test_sync.py index a01ab471f5..9825bb65c0 100644 --- a/tests/handlers/test_sync.py +++ b/tests/handlers/test_sync.py @@ -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) diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py index c2e88bdbaf..5df78b3d0a 100644 --- a/tests/storage/test_client_ips.py +++ b/tests/storage/test_client_ips.py @@ -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) diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py index f2ed866ae7..d15323b896 100644 --- a/tests/storage/test_monthly_active_users.py +++ b/tests/storage/test_monthly_active_users.py @@ -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): |