mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-08-02 03:26:20 -04:00
store: The daemon clients need to be per homeserver.
This commit is contained in:
parent
d1090a714a
commit
ea33359daa
3 changed files with 109 additions and 25 deletions
|
@ -68,12 +68,12 @@ def panstore(tempdir):
|
|||
|
||||
class TestClass(object):
|
||||
def test_account_loading(self, panstore):
|
||||
accounts = panstore.get_users()
|
||||
accounts = panstore.load_all_users()
|
||||
# pdb.set_trace()
|
||||
assert len(accounts) == 10
|
||||
|
||||
def test_token_saving(self, panstore, access_token):
|
||||
accounts = panstore.get_users()
|
||||
accounts = panstore.load_all_users()
|
||||
user_id = accounts[0][0]
|
||||
device_id = accounts[0][1]
|
||||
|
||||
|
@ -83,15 +83,32 @@ class TestClass(object):
|
|||
access_token == token
|
||||
|
||||
def test_child_clinets_storing(self, panstore, client):
|
||||
clients = panstore.load_clients()
|
||||
server = faker.hostname()
|
||||
clients = panstore.load_clients(server)
|
||||
assert not clients
|
||||
|
||||
panstore.save_client(client)
|
||||
panstore.save_client(server, client)
|
||||
|
||||
clients = panstore.load_clients()
|
||||
clients = panstore.load_clients(server)
|
||||
assert clients
|
||||
|
||||
client2 = faker.client()
|
||||
panstore.save_client(client2)
|
||||
clients = panstore.load_clients()
|
||||
panstore.save_client(server, client2)
|
||||
clients = panstore.load_clients(server)
|
||||
assert len(clients) == 2
|
||||
|
||||
def test_server_account_storing(self, panstore):
|
||||
accounts = panstore.load_all_users()
|
||||
|
||||
user_id, device_id = accounts[0]
|
||||
server = faker.hostname()
|
||||
|
||||
panstore.save_server_user(server, user_id)
|
||||
|
||||
server2 = faker.hostname()
|
||||
user_id2, device_id2 = accounts[1]
|
||||
panstore.save_server_user(server2, user_id2)
|
||||
|
||||
server_users = panstore.load_users(server)
|
||||
assert (user_id, device_id) in server_users
|
||||
assert (user_id2, device_id2) not in server_users
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue