From 4e743e7f9ebc512d2c1f8027fa6484f2ebf7dc54 Mon Sep 17 00:00:00 2001 From: Stefan Bohacek Date: Wed, 15 Feb 2023 10:51:08 -0500 Subject: [PATCH] Added missing verified_at attribute when updating profile fields. --- mastodon/accounts.py | 4 ++-- tests/test_account.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mastodon/accounts.py b/mastodon/accounts.py index cd43c57..cee7a84 100644 --- a/mastodon/accounts.py +++ b/mastodon/accounts.py @@ -427,10 +427,10 @@ class Mastodon(Internals): raise MastodonIllegalArgumentError( 'A maximum of four fields are allowed.') - fields_attributes = [] - for idx, (field_name, field_value) in enumerate(fields): + for idx, (field_name, field_value, field_verified_at) in enumerate(fields): params_initial[f'fields_attributes[{idx}][name]'] = field_name params_initial[f'fields_attributes[{idx}][value]'] = field_value + params_initial[f'fields_attributes[{idx}][verified_at]'] = field_verified_at # Clean up params for param in ["avatar", "avatar_mime_type", "header", "header_mime_type", "fields"]: diff --git a/tests/test_account.py b/tests/test_account.py index afc2122..1142f1b 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -119,8 +119,8 @@ def test_account_update_credentials(api): header = image, header_mime_type = "image/jpeg", fields = [ - ("bread", "toasty."), - ("lasagna", "no!!!"), + ("bread", "toasty.", None), + ("lasagna", "no!!!", None), ] ) @@ -136,11 +136,11 @@ def test_account_update_credentials(api): def test_account_update_credentials_too_many_fields(api): with pytest.raises(MastodonIllegalArgumentError): api.account_update_credentials(fields = [ - ('a', 'b'), - ('c', 'd'), - ('e', 'f'), - ('g', 'h'), - ('i', 'j'), + ('a', 'b', 'c'), + ('d', 'e', 'f'), + ('g', 'h', 'i'), + ('j', 'k', 'l'), + ('m', 'n', 'o'), ]) @pytest.mark.vcr(match_on=['path'])