mirror of
https://github.com/ihabunek/toot
synced 2025-02-13 10:30:38 +01:00
Add --json option to update_account
This commit is contained in:
parent
e961bd696d
commit
7929919ffc
@ -1,5 +1,6 @@
|
|||||||
from tests.integration.conftest import TRUMPET
|
from tests.integration.conftest import TRUMPET
|
||||||
from toot import api
|
from toot import api
|
||||||
|
from toot.entities import Account, from_dict
|
||||||
from toot.utils import get_text
|
from toot.utils import get_text
|
||||||
|
|
||||||
|
|
||||||
@ -16,6 +17,13 @@ def test_update_account_display_name(run, app, user):
|
|||||||
assert account["display_name"] == "elwood"
|
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):
|
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 "
|
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.")
|
"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):
|
if all(option is None for option in options):
|
||||||
raise ConsoleError("Please specify at least one option to update the account")
|
raise ConsoleError("Please specify at least one option to update the account")
|
||||||
|
|
||||||
api.update_account(
|
response = api.update_account(
|
||||||
app,
|
app,
|
||||||
user,
|
user,
|
||||||
avatar=args.avatar,
|
avatar=args.avatar,
|
||||||
@ -355,7 +355,10 @@ def update_account(app, user, args):
|
|||||||
sensitive=args.sensitive,
|
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):
|
def login_cli(app, user, args):
|
||||||
|
@ -370,6 +370,7 @@ AUTH_COMMANDS = [
|
|||||||
"type": language,
|
"type": language,
|
||||||
"help": "Default language to use for authored statuses (ISO 639-1)."
|
"help": "Default language to use for authored statuses (ISO 639-1)."
|
||||||
}),
|
}),
|
||||||
|
json_arg,
|
||||||
],
|
],
|
||||||
require_auth=True,
|
require_auth=True,
|
||||||
),
|
),
|
||||||
|
@ -72,6 +72,7 @@ class Account:
|
|||||||
statuses_count: int
|
statuses_count: int
|
||||||
followers_count: int
|
followers_count: int
|
||||||
following_count: int
|
following_count: int
|
||||||
|
source: Optional[dict]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __toot_prepare__(obj: Dict) -> Dict:
|
def __toot_prepare__(obj: Dict) -> Dict:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user