mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 05:16:28 +03:00
api: Rename add_transport() -> add_or_update_transport() (#6800)
cc @nicodh
This commit is contained in:
@@ -111,9 +111,9 @@ class Account:
|
||||
yield self._rpc.configure.future(self.id)
|
||||
|
||||
@futuremethod
|
||||
def add_transport(self, params):
|
||||
def add_or_update_transport(self, params):
|
||||
"""Add a new transport."""
|
||||
yield self._rpc.add_transport.future(self.id, params)
|
||||
yield self._rpc.add_or_update_transport.future(self.id, params)
|
||||
|
||||
def bring_online(self):
|
||||
"""Start I/O and wait until IMAP becomes IDLE."""
|
||||
|
||||
@@ -34,7 +34,7 @@ class ACFactory:
|
||||
addr, password = self.get_credentials()
|
||||
account = self.get_unconfigured_account()
|
||||
params = {"addr": addr, "password": password}
|
||||
yield account.add_transport.future(params)
|
||||
yield account.add_or_update_transport.future(params)
|
||||
|
||||
assert account.is_configured()
|
||||
return account
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_event_on_configuration(acfactory: ACFactory) -> None:
|
||||
account = acfactory.get_unconfigured_account()
|
||||
account.clear_all_events()
|
||||
assert not account.is_configured()
|
||||
future = account.add_transport.future({"addr": addr, "password": password})
|
||||
future = account.add_or_update_transport.future({"addr": addr, "password": password})
|
||||
while True:
|
||||
event = account.wait_for_event()
|
||||
if event.kind == EventType.ACCOUNTS_ITEM_CHANGED:
|
||||
|
||||
@@ -63,7 +63,7 @@ def test_acfactory(acfactory) -> None:
|
||||
def test_configure_starttls(acfactory) -> None:
|
||||
addr, password = acfactory.get_credentials()
|
||||
account = acfactory.get_unconfigured_account()
|
||||
account.add_transport(
|
||||
account.add_or_update_transport(
|
||||
{
|
||||
"addr": addr,
|
||||
"password": password,
|
||||
@@ -80,7 +80,7 @@ def test_configure_ip(acfactory) -> None:
|
||||
ip_address = socket.gethostbyname(addr.rsplit("@")[-1])
|
||||
|
||||
with pytest.raises(JsonRpcError):
|
||||
account.add_transport(
|
||||
account.add_or_update_transport(
|
||||
{
|
||||
"addr": addr,
|
||||
"password": password,
|
||||
@@ -94,7 +94,7 @@ def test_configure_alternative_port(acfactory) -> None:
|
||||
"""Test that configuration with alternative port 443 works."""
|
||||
addr, password = acfactory.get_credentials()
|
||||
account = acfactory.get_unconfigured_account()
|
||||
account.add_transport(
|
||||
account.add_or_update_transport(
|
||||
{
|
||||
"addr": addr,
|
||||
"password": password,
|
||||
@@ -108,7 +108,7 @@ def test_configure_alternative_port(acfactory) -> None:
|
||||
def test_list_transports(acfactory) -> None:
|
||||
addr, password = acfactory.get_credentials()
|
||||
account = acfactory.get_unconfigured_account()
|
||||
account.add_transport(
|
||||
account.add_or_update_transport(
|
||||
{
|
||||
"addr": addr,
|
||||
"password": password,
|
||||
@@ -420,7 +420,7 @@ def test_wait_next_messages(acfactory) -> None:
|
||||
addr, password = acfactory.get_credentials()
|
||||
bot = acfactory.get_unconfigured_account()
|
||||
bot.set_config("bot", "1")
|
||||
bot.add_transport({"addr": addr, "password": password})
|
||||
bot.add_or_update_transport({"addr": addr, "password": password})
|
||||
assert bot.is_configured()
|
||||
|
||||
# There are no old messages and the call returns immediately.
|
||||
@@ -603,7 +603,7 @@ def test_reactions_for_a_reordering_move(acfactory, direct_imap):
|
||||
|
||||
addr, password = acfactory.get_credentials()
|
||||
ac2 = acfactory.get_unconfigured_account()
|
||||
ac2.add_transport({"addr": addr, "password": password})
|
||||
ac2.add_or_update_transport({"addr": addr, "password": password})
|
||||
ac2.set_config("mvbox_move", "1")
|
||||
assert ac2.is_configured()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user