diff --git a/tests/integration/test_auth.py b/tests/integration/test_auth.py
index 6b52b1c..6720f8b 100644
--- a/tests/integration/test_auth.py
+++ b/tests/integration/test_auth.py
@@ -1,5 +1,6 @@
from tests.integration.conftest import TRUMPET
from toot import api
+from toot.entities import Account, from_dict
from toot.utils import get_text
@@ -16,6 +17,13 @@ def test_update_account_display_name(run, app, user):
assert account["display_name"] == "elwood"
+def test_update_account_json(run_json, app, user):
+ out = run_json("update_account", "--display-name", "elwood", "--json")
+ account = from_dict(Account, out)
+ assert account.acct == user.username
+ assert account.display_name == "elwood"
+
+
def test_update_account_note(run, app, user):
note = ("It's 106 miles to Chicago, we got a full tank of gas, half a pack "
"of cigarettes, it's dark... and we're wearing sunglasses.")
diff --git a/toot/commands.py b/toot/commands.py
index 92d0085..d564cbf 100644
--- a/toot/commands.py
+++ b/toot/commands.py
@@ -340,7 +340,7 @@ def update_account(app, user, args):
if all(option is None for option in options):
raise ConsoleError("Please specify at least one option to update the account")
- api.update_account(
+ response = api.update_account(
app,
user,
avatar=args.avatar,
@@ -355,7 +355,10 @@ def update_account(app, user, args):
sensitive=args.sensitive,
)
- print_out("✓ Account updated")
+ if args.json:
+ print(response.text)
+ else:
+ print_out("✓ Account updated")
def login_cli(app, user, args):
diff --git a/toot/console.py b/toot/console.py
index 70d5bed..41583c1 100644
--- a/toot/console.py
+++ b/toot/console.py
@@ -370,6 +370,7 @@ AUTH_COMMANDS = [
"type": language,
"help": "Default language to use for authored statuses (ISO 639-1)."
}),
+ json_arg,
],
require_auth=True,
),
diff --git a/toot/entities.py b/toot/entities.py
index 17f7406..d41a236 100644
--- a/toot/entities.py
+++ b/toot/entities.py
@@ -72,6 +72,7 @@ class Account:
statuses_count: int
followers_count: int
following_count: int
+ source: Optional[dict]
@staticmethod
def __toot_prepare__(obj: Dict) -> Dict: