mirror of
https://github.com/ihabunek/toot
synced 2024-12-23 15:37:47 +01:00
Add a "reblogged_by" command
This commit is contained in:
parent
5514c47bca
commit
f1c8465e63
@ -259,6 +259,35 @@ def test_thread(mock_get, monkeypatch, capsys):
|
||||
assert "111111111111111111" in out
|
||||
assert "In reply to" in out
|
||||
|
||||
@mock.patch('toot.http.get')
|
||||
def test_reblogged_by(mock_get, monkeypatch, capsys):
|
||||
mock_get.return_value = MockResponse([{
|
||||
'display_name': 'Terry Bozzio',
|
||||
'acct': 'bozzio@drummers.social',
|
||||
}, {
|
||||
'display_name': 'Dweezil',
|
||||
'acct': 'dweezil@zappafamily.social',
|
||||
}])
|
||||
|
||||
console.run_command(app, user, 'reblogged_by', ['111111111111111111'])
|
||||
|
||||
calls = [
|
||||
mock.call(app, user, '/api/v1/statuses/111111111111111111/reblogged_by'),
|
||||
]
|
||||
mock_get.assert_has_calls(calls, any_order=False)
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
|
||||
# Display order
|
||||
expected = "\n".join([
|
||||
"Terry Bozzio",
|
||||
" @bozzio@drummers.social",
|
||||
"Dweezil",
|
||||
" @dweezil@zappafamily.social",
|
||||
"",
|
||||
])
|
||||
assert out == expected
|
||||
|
||||
@mock.patch('toot.http.post')
|
||||
def test_upload(mock_post, capsys):
|
||||
mock_post.return_value = MockResponse({
|
||||
|
@ -151,6 +151,12 @@ def context(app, user, status_id):
|
||||
return http.get(app, user, url).json()
|
||||
|
||||
|
||||
def reblogged_by(app, user, status_id):
|
||||
url = '/api/v1/statuses/{}/reblogged_by'.format(status_id)
|
||||
|
||||
return http.get(app, user, url).json()
|
||||
|
||||
|
||||
def _get_next_path(headers):
|
||||
"""Given timeline response headers, returns the path to the next batch"""
|
||||
links = headers.get('Link', '')
|
||||
|
@ -144,6 +144,11 @@ def unpin(app, user, args):
|
||||
print_out("<green>✓ Status unpinned</green>")
|
||||
|
||||
|
||||
def reblogged_by(app, user, args):
|
||||
for account in api.reblogged_by(app, user, args.status_id):
|
||||
print_out("{}\n @{}".format(account['display_name'], account['acct']))
|
||||
|
||||
|
||||
def auth(app, user, args):
|
||||
config_data = config.load_config()
|
||||
|
||||
|
@ -316,6 +316,12 @@ STATUS_COMMANDS = [
|
||||
arguments=[status_id_arg],
|
||||
require_auth=True,
|
||||
),
|
||||
Command(
|
||||
name="reblogged_by",
|
||||
description="Show accounts that reblogged the status",
|
||||
arguments=[status_id_arg],
|
||||
require_auth=False,
|
||||
),
|
||||
Command(
|
||||
name="pin",
|
||||
description="Pin a status",
|
||||
|
Loading…
Reference in New Issue
Block a user