summary refs log tree commit diff
path: root/tests/storage
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-09-06 17:22:53 +0100
committerNeil Johnson <neil@matrix.org>2018-09-06 17:22:53 +0100
commit84a750e0c36f653b71a06c564154f257c1b7dee3 (patch)
tree60b82bcc541df570b7e1cca4a65cdfe16a6b6ec0 /tests/storage
parenttowncrier (diff)
downloadsynapse-84a750e0c36f653b71a06c564154f257c1b7dee3.tar.xz
ensure guests never enter mau list
Diffstat (limited to 'tests/storage')
-rw-r--r--tests/storage/test_client_ips.py4
-rw-r--r--tests/storage/test_monthly_active_users.py6
2 files changed, 6 insertions, 4 deletions
diff --git a/tests/storage/test_client_ips.py b/tests/storage/test_client_ips.py
index c2e88bdbaf..c9b02a062b 100644
--- a/tests/storage/test_client_ips.py
+++ b/tests/storage/test_client_ips.py
@@ -101,6 +101,7 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
         self.hs.config.limit_usage_by_mau = True
         self.hs.config.max_mau_value = 50
         user_id = "@user:server"
+        yield self.store.register(user_id=user_id, token="123", password_hash=None)
 
         active = yield self.store.user_last_seen_monthly_active(user_id)
         self.assertFalse(active)
@@ -108,8 +109,5 @@ class ClientIpStoreTestCase(tests.unittest.TestCase):
         yield self.store.insert_client_ip(
             user_id, "access_token", "ip", "user_agent", "device_id"
         )
-        yield self.store.insert_client_ip(
-            user_id, "access_token", "ip", "user_agent", "device_id"
-        )
         active = yield self.store.user_last_seen_monthly_active(user_id)
         self.assertTrue(active)
diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py
index cfe0a7c77d..ccfc21b7fc 100644
--- a/tests/storage/test_monthly_active_users.py
+++ b/tests/storage/test_monthly_active_users.py
@@ -146,8 +146,12 @@ class MonthlyActiveUsersTestCase(HomeserverTestCase):
 
     def test_populate_monthly_users_is_guest(self):
         # Test that guest users are not added to mau list
+        user_id = "user_id"
+        self.store.register(
+            user_id=user_id, token="123", password_hash=None, make_guest=True
+        )
         self.store.upsert_monthly_active_user = Mock()
-        self.store.populate_monthly_active_users('user_id', True)
+        self.store.populate_monthly_active_users(user_id)
         self.pump()
         self.store.upsert_monthly_active_user.assert_not_called()