def test_accounts_get_set(self, account_list, unused_tcp_port): """Test the account getting and setting.""" siac = SIAClient( host="", port=unused_tcp_port, accounts=account_list, function=(lambda ev: print(ev)), ) assert siac.accounts == account_list acc_list2 = [ SIAAccount(account_id=ACCOUNT, key=KEY, allowed_timeband=(None, None)), SIAAccount(account_id="1112", key=KEY, allowed_timeband=(None, None)), ] siac.accounts = acc_list2 assert siac.accounts == acc_list2
with open("unencrypted_config.json", "r") as f: config = json.load(f) account = [SIAAccount(config["account_id"], config["key"])] client = SIAClient(config["host"], config["port"], account, function=func) sleep_time = 120 client.start() time.sleep(20) print(f"Client started... adding extra account") accounts = client.accounts accounts.append(SIAAccount("FFFFFFFFF", config["key"])) client.accounts = accounts print("--------------------------------------------------") print(f"Running for another {sleep_time} seconds") time.sleep(sleep_time) print(f"Client will stop now...") print("--------------------------------------------------") client.stop() # for ev in events: # print(ev) print("--------------------------------------------------") print(len(events)) print(client.counts) print("--------------------------------------------------")