From 437f68c29a18303de3c75962021bbe030b2cf85c Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Fri, 11 Oct 2019 23:59:24 +0200 Subject: Update tests for 3.0.1 and fix regressions --- mastodon/Mastodon.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 7f9a008..2a9833b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -1812,7 +1812,7 @@ class Mastodon: if self.verify_minimum_version("2.9.2"): url = '/api/v1/notifications/{0}/dismiss'.format(str(id)) - return self.__api_request('POST', '/api/v1/notifications/dismiss', params) + self.__api_request('POST', url) else: params = self.__generate_params(locals()) self.__api_request('POST', '/api/v1/notifications/dismiss', params) @@ -2307,7 +2307,10 @@ class Mastodon: if mention_events != None: params['data[alerts][mention]'] = mention_events - + + # Canonicalize booleans + params = self.__generate_params(params) + return self.__api_request('POST', '/api/v1/push/subscription', params) @api_version("2.4.0", "2.4.0", __DICT_VERSION_PUSH) @@ -2333,6 +2336,9 @@ class Mastodon: if mention_events != None: params['data[alerts][mention]'] = mention_events + # Canonicalize booleans + params = self.__generate_params(params) + return self.__api_request('PUT', '/api/v1/push/subscription', params) @api_version("2.4.0", "2.4.0", "2.4.0") @@ -2862,9 +2868,9 @@ class Mastodon: """ for key in ('follow', 'favourite', 'reblog', 'mention'): if (key in json_object and isinstance(json_object[key], six.text_type)): - if json_object[key] == 'True': + if json_object[key].lower() == 'true': json_object[key] = True - if json_object[key] == 'False': + if json_object[key].lower() == 'False': json_object[key] = False return json_object @@ -3270,7 +3276,9 @@ class Mastodon: """ params = collections.OrderedDict(params) - del params['self'] + if 'self' in params: + del params['self'] + param_keys = list(params.keys()) for key in param_keys: if isinstance(params[key], bool) and params[key] == False: -- cgit v1.2.3