Add --json option to update_account
This commit is contained in:
parent
e961bd696d
commit
7929919ffc
4 changed files with 15 additions and 2 deletions
|
@ -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.")
|
||||
|
|
|
@ -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("<green>✓ Account updated</green>")
|
||||
if args.json:
|
||||
print(response.text)
|
||||
else:
|
||||
print_out("<green>✓ Account updated</green>")
|
||||
|
||||
|
||||
def login_cli(app, user, args):
|
||||
|
|
|
@ -370,6 +370,7 @@ AUTH_COMMANDS = [
|
|||
"type": language,
|
||||
"help": "Default language to use for authored statuses (ISO 639-1)."
|
||||
}),
|
||||
json_arg,
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue