parent
b2626a9aa8
commit
d6f5728486
2 changed files with 9 additions and 12 deletions
|
@ -42,11 +42,7 @@ def test_post_defaults(mock_post, mock_uuid, capsys):
|
|||
'status': 'Hello world',
|
||||
'visibility': 'public',
|
||||
'media_ids': [],
|
||||
'sensitive': "false",
|
||||
'spoiler_text': None,
|
||||
'in_reply_to_id': None,
|
||||
'language': None,
|
||||
'scheduled_at': None,
|
||||
'sensitive': False,
|
||||
}, headers={"Idempotency-Key": "rock-on"})
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
|
@ -78,11 +74,10 @@ def test_post_with_options(mock_post, mock_uuid, capsys):
|
|||
'status': 'Hello world',
|
||||
'media_ids': [],
|
||||
'visibility': 'unlisted',
|
||||
'sensitive': "true",
|
||||
'sensitive': True,
|
||||
'spoiler_text': "Spoiler!",
|
||||
'in_reply_to_id': '123a',
|
||||
'language': 'hrv',
|
||||
'scheduled_at': None,
|
||||
}, headers={"Idempotency-Key": "up-the-irons"})
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
|
|
12
toot/api.py
12
toot/api.py
|
@ -140,15 +140,17 @@ def post_status(
|
|||
'status': status,
|
||||
'media_ids': media_ids,
|
||||
'visibility': visibility,
|
||||
'sensitive': str_bool(sensitive),
|
||||
'spoiler_text': spoiler_text,
|
||||
'sensitive': sensitive,
|
||||
'in_reply_to_id': in_reply_to_id,
|
||||
'language': language,
|
||||
'scheduled_at': scheduled_at
|
||||
'scheduled_at': scheduled_at,
|
||||
'content_type': content_type,
|
||||
'spoiler_text': spoiler_text
|
||||
}
|
||||
|
||||
if content_type:
|
||||
json['content_type'] = content_type
|
||||
# Strip keys for which value is None
|
||||
# Sending null values doesn't bother Mastodon, but it breaks Pleroma
|
||||
json = {k: v for k, v in json.items() if v is not None}
|
||||
|
||||
return http.post(app, user, '/api/v1/statuses', json=json, headers=headers).json()
|
||||
|
||||
|
|
Loading…
Reference in a new issue