Use v2 endpoint to upload media

v1 is deprecated
This commit is contained in:
Ivan Habunek 2023-03-03 08:57:34 +01:00
parent 7ed28b3bc3
commit 14a286ef0d
No known key found for this signature in database
GPG key ID: F5F0623FF5EBCB3D
2 changed files with 3 additions and 3 deletions

View file

@ -300,10 +300,10 @@ def test_upload(mock_post, capsys):
console.run_command(app, user, 'upload', [__file__])
mock_post.call_count == 1
assert mock_post.call_count == 1
args, kwargs = http.post.call_args
assert args == (app, user, '/api/v1/media')
assert args == (app, user, '/api/v2/media')
assert isinstance(kwargs['files']['file'], io.BufferedReader)
out, err = capsys.readouterr()

View file

@ -348,7 +348,7 @@ def anon_tag_timeline_generator(instance, hashtag, local=False, limit=20):
def upload_media(app, user, file, description=None):
return http.post(app, user, '/api/v1/media',
return http.post(app, user, '/api/v2/media',
data={'description': description},
files={'file': file}
).json()