diff options
-rw-r--r-- | docs/index.rst | 14 | ||||
-rw-r--r-- | mastodon/Mastodon.py | 160 | ||||
-rw-r--r-- | mastodon/streaming.py | 50 | ||||
-rw-r--r-- | tests/README.markdown | 2 | ||||
-rw-r--r-- | tests/cassettes/test_bookmarks.yaml | 535 | ||||
-rw-r--r-- | tests/cassettes/test_domain_blocks.yaml | 7 | ||||
-rw-r--r-- | tests/cassettes/test_fetch_next_previous_from_pagination_info_oldstyle.yaml | 749 | ||||
-rw-r--r-- | tests/conftest.py | 3 | ||||
-rw-r--r-- | tests/test_bookmarks.py | 5 | ||||
-rw-r--r-- | tests/test_create_app.py | 2 | ||||
-rw-r--r-- | tests/test_pagination.py | 28 | ||||
-rw-r--r-- | tests/test_streaming.py | 40 |
12 files changed, 1406 insertions, 189 deletions
diff --git a/docs/index.rst b/docs/index.rst index 473777a..e7b1ed9 100644 --- a/docs/index.rst +++ b/docs/index.rst | |||
@@ -1275,6 +1275,19 @@ The streaming functions take instances of `StreamListener` as the `listener` par | |||
1275 | A `CallbackStreamListener` class that allows you to specify function callbacks | 1275 | A `CallbackStreamListener` class that allows you to specify function callbacks |
1276 | directly is included for convenience. | 1276 | directly is included for convenience. |
1277 | 1277 | ||
1278 | For new well-known events implement the streaming function in `StreamListener` or `CallbackStreamListener`. | ||
1279 | The function name is `on_` + the event name. If the event-name contains dots, use an underscore instead. | ||
1280 | |||
1281 | E.g. for `'status.update'` the listener function should be named as `on_status_update`. | ||
1282 | |||
1283 | It may be that future Mastodon versions will come with completely new (unknown) event names. In this | ||
1284 | case a (deprecated) Mastodon.py would throw an error. If you want to avoid this in general, you can | ||
1285 | override the listener function `on_unknown_event`. This has an additional parameter `name` which informs | ||
1286 | about the name of the event. `unknown_event` contains the content of the event. | ||
1287 | |||
1288 | Alternatively, a callback function can be passed in the `unknown_event_handler` parameter in the | ||
1289 | `CallbackStreamListener` constructor. | ||
1290 | |||
1278 | When in not-async mode or async mode without async_reconnect, the stream functions may raise | 1291 | When in not-async mode or async mode without async_reconnect, the stream functions may raise |
1279 | various exceptions: `MastodonMalformedEventError` if a received event cannot be parsed and | 1292 | various exceptions: `MastodonMalformedEventError` if a received event cannot be parsed and |
1280 | `MastodonNetworkError` if any connection problems occur. | 1293 | `MastodonNetworkError` if any connection problems occur. |
@@ -1294,6 +1307,7 @@ StreamListener | |||
1294 | .. automethod:: StreamListener.on_notification | 1307 | .. automethod:: StreamListener.on_notification |
1295 | .. automethod:: StreamListener.on_delete | 1308 | .. automethod:: StreamListener.on_delete |
1296 | .. automethod:: StreamListener.on_conversation | 1309 | .. automethod:: StreamListener.on_conversation |
1310 | .. automethod:: StreamListener.on_unknown_event | ||
1297 | .. automethod:: StreamListener.on_abort | 1311 | .. automethod:: StreamListener.on_abort |
1298 | .. automethod:: StreamListener.handle_heartbeat | 1312 | .. automethod:: StreamListener.handle_heartbeat |
1299 | 1313 | ||
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index bdf7f1b..296921e 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -120,10 +120,27 @@ class AttribAccessDict(dict): | |||
120 | raise AttributeError("Attribute-style access is read only") | 120 | raise AttributeError("Attribute-style access is read only") |
121 | super(AttribAccessDict, self).__setattr__(attr, val) | 121 | super(AttribAccessDict, self).__setattr__(attr, val) |
122 | 122 | ||
123 | |||
123 | ### | 124 | ### |
124 | # The actual Mastodon class | 125 | # List helper class. |
126 | # Defined at top level so it can be pickled. | ||
125 | ### | 127 | ### |
128 | class AttribAccessList(list): | ||
129 | def __getattr__(self, attr): | ||
130 | if attr in self: | ||
131 | return self[attr] | ||
132 | else: | ||
133 | raise AttributeError("Attribute not found: " + str(attr)) | ||
134 | |||
135 | def __setattr__(self, attr, val): | ||
136 | if attr in self: | ||
137 | raise AttributeError("Attribute-style access is read only") | ||
138 | super(AttribAccessList, self).__setattr__(attr, val) | ||
139 | |||
126 | 140 | ||
141 | ### | ||
142 | # The actual Mastodon class | ||
143 | ### | ||
127 | class Mastodon: | 144 | class Mastodon: |
128 | """ | 145 | """ |
129 | Thorough and easy to use Mastodon | 146 | Thorough and easy to use Mastodon |
@@ -276,6 +293,7 @@ class Mastodon: | |||
276 | secret_file.write(response['client_id'] + "\n") | 293 | secret_file.write(response['client_id'] + "\n") |
277 | secret_file.write(response['client_secret'] + "\n") | 294 | secret_file.write(response['client_secret'] + "\n") |
278 | secret_file.write(api_base_url + "\n") | 295 | secret_file.write(api_base_url + "\n") |
296 | secret_file.write(client_name + "\n") | ||
279 | 297 | ||
280 | return (response['client_id'], response['client_secret']) | 298 | return (response['client_id'], response['client_secret']) |
281 | 299 | ||
@@ -286,7 +304,7 @@ class Mastodon: | |||
286 | api_base_url=None, debug_requests=False, | 304 | api_base_url=None, debug_requests=False, |
287 | ratelimit_method="wait", ratelimit_pacefactor=1.1, | 305 | ratelimit_method="wait", ratelimit_pacefactor=1.1, |
288 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, | 306 | request_timeout=__DEFAULT_TIMEOUT, mastodon_version=None, |
289 | version_check_mode = "created", session=None, feature_set="mainline"): | 307 | version_check_mode = "created", session=None, feature_set="mainline", user_agent=None): |
290 | """ | 308 | """ |
291 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you | 309 | Create a new API wrapper instance based on the given `client_secret` and `client_id`. If you |
292 | give a `client_id` and it is not a file, you must also give a secret. If you specify an | 310 | give a `client_id` and it is not a file, you must also give a secret. If you specify an |
@@ -331,6 +349,11 @@ class Mastodon: | |||
331 | `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. | 349 | `feature_set` can be used to enable behaviour specific to non-mainline Mastodon API implementations. |
332 | Details are documented in the functions that provide such functionality. Currently supported feature | 350 | Details are documented in the functions that provide such functionality. Currently supported feature |
333 | sets are `mainline`, `fedibird` and `pleroma`. | 351 | sets are `mainline`, `fedibird` and `pleroma`. |
352 | |||
353 | For some mastodon-instances a `User-Agent` header is needed. This can be set by parameter `user_agent`. From now | ||
354 | `create_app()` stores the application name into the client secret file. If `client_id` points to this file, | ||
355 | the app name will be used as `User-Agent` header as default. It's possible to modify old secret files and append | ||
356 | a client app name to use it as a `User-Agent` name. | ||
334 | """ | 357 | """ |
335 | self.api_base_url = None | 358 | self.api_base_url = None |
336 | if not api_base_url is None: | 359 | if not api_base_url is None: |
@@ -362,6 +385,9 @@ class Mastodon: | |||
362 | self.feature_set = feature_set | 385 | self.feature_set = feature_set |
363 | if not self.feature_set in ["mainline", "fedibird", "pleroma"]: | 386 | if not self.feature_set in ["mainline", "fedibird", "pleroma"]: |
364 | raise MastodonIllegalArgumentError('Requested invalid feature set') | 387 | raise MastodonIllegalArgumentError('Requested invalid feature set') |
388 | |||
389 | # General defined user-agent | ||
390 | self.user_agent = user_agent | ||
365 | 391 | ||
366 | # Token loading | 392 | # Token loading |
367 | if self.client_id is not None: | 393 | if self.client_id is not None: |
@@ -376,6 +402,11 @@ class Mastodon: | |||
376 | if not (self.api_base_url is None or try_base_url == self.api_base_url): | 402 | if not (self.api_base_url is None or try_base_url == self.api_base_url): |
377 | raise MastodonIllegalArgumentError('Mismatch in base URLs between files and/or specified') | 403 | raise MastodonIllegalArgumentError('Mismatch in base URLs between files and/or specified') |
378 | self.api_base_url = try_base_url | 404 | self.api_base_url = try_base_url |
405 | |||
406 | # With new registrations we support the 4th line to store a client_name and use it as user-agent | ||
407 | client_name = secret_file.readline() | ||
408 | if client_name and self.user_agent is None: | ||
409 | self.user_agent = client_name.rstrip() | ||
379 | else: | 410 | else: |
380 | if self.client_secret is None: | 411 | if self.client_secret is None: |
381 | raise MastodonIllegalArgumentError('Specified client id directly, but did not supply secret') | 412 | raise MastodonIllegalArgumentError('Specified client id directly, but did not supply secret') |
@@ -390,20 +421,20 @@ class Mastodon: | |||
390 | if not (self.api_base_url is None or try_base_url == self.api_base_url): | 421 | if not (self.api_base_url is None or try_base_url == self.api_base_url): |
391 | raise MastodonIllegalArgumentError('Mismatch in base URLs between files and/or specified') | 422 | raise MastodonIllegalArgumentError('Mismatch in base URLs between files and/or specified') |
392 | self.api_base_url = try_base_url | 423 | self.api_base_url = try_base_url |
424 | |||
425 | if not version_check_mode in ["created", "changed", "none"]: | ||
426 | raise MastodonIllegalArgumentError("Invalid version check method.") | ||
427 | self.version_check_mode = version_check_mode | ||
393 | 428 | ||
394 | # Versioning | 429 | # Versioning |
395 | if mastodon_version == None: | 430 | if mastodon_version == None and self.version_check_mode != 'none': |
396 | self.retrieve_mastodon_version() | 431 | self.retrieve_mastodon_version() |
397 | else: | 432 | elif self.version_check_mode != 'none': |
398 | try: | 433 | try: |
399 | self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(mastodon_version) | 434 | self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(mastodon_version) |
400 | except: | 435 | except: |
401 | raise MastodonVersionError("Bad version specified") | 436 | raise MastodonVersionError("Bad version specified") |
402 | 437 | ||
403 | if not version_check_mode in ["created", "changed", "none"]: | ||
404 | raise MastodonIllegalArgumentError("Invalid version check method.") | ||
405 | self.version_check_mode = version_check_mode | ||
406 | |||
407 | # Ratelimiting parameter check | 438 | # Ratelimiting parameter check |
408 | if ratelimit_method not in ["throw", "wait", "pace"]: | 439 | if ratelimit_method not in ["throw", "wait", "pace"]: |
409 | raise MastodonIllegalArgumentError("Invalid ratelimit method.") | 440 | raise MastodonIllegalArgumentError("Invalid ratelimit method.") |
@@ -965,10 +996,13 @@ class Mastodon: | |||
965 | # Reading data: Notifications | 996 | # Reading data: Notifications |
966 | ### | 997 | ### |
967 | @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION) | 998 | @api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION) |
968 | def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, mentions_only=None): | 999 | def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None): |
969 | """ | 1000 | """ |
970 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in | 1001 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in |
971 | user. Pass `account_id` to get only notifications originating from the given account. | 1002 | user. Pass `account_id` to get only notifications originating from the given account. |
1003 | |||
1004 | Parameter `exclude_types` is an array of the following `follow`, `favourite`, `reblog`, | ||
1005 | `mention`, `poll`, `follow_request` | ||
972 | 1006 | ||
973 | Can be passed an `id` to fetch a single notification. | 1007 | Can be passed an `id` to fetch a single notification. |
974 | 1008 | ||
@@ -1028,8 +1062,8 @@ class Mastodon: | |||
1028 | """ | 1062 | """ |
1029 | return self.account_verify_credentials() | 1063 | return self.account_verify_credentials() |
1030 | 1064 | ||
1031 | @api_version("1.0.0", "2.7.0", __DICT_VERSION_STATUS) | 1065 | @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) |
1032 | def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, max_id=None, min_id=None, since_id=None, limit=None): | 1066 | def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, exclude_reblogs=False, tagged=None, max_id=None, min_id=None, since_id=None, limit=None): |
1033 | """ | 1067 | """ |
1034 | Fetch statuses by user `id`. Same options as `timeline()`_ are permitted. | 1068 | Fetch statuses by user `id`. Same options as `timeline()`_ are permitted. |
1035 | Returned toots are from the perspective of the logged-in user, i.e. | 1069 | Returned toots are from the perspective of the logged-in user, i.e. |
@@ -1040,6 +1074,8 @@ class Mastodon: | |||
1040 | If `pinned` is set, return only statuses that have been pinned. Note that | 1074 | If `pinned` is set, return only statuses that have been pinned. Note that |
1041 | as of Mastodon 2.1.0, this only works properly for instance-local users. | 1075 | as of Mastodon 2.1.0, this only works properly for instance-local users. |
1042 | If `exclude_replies` is set, filter out all statuses that are replies. | 1076 | If `exclude_replies` is set, filter out all statuses that are replies. |
1077 | If `exclude_reblogs` is set, filter out all statuses that are reblogs. | ||
1078 | If `tagged` is set, return only statuses that are tagged with `tagged`. Only a single tag without a '#' is valid. | ||
1043 | 1079 | ||
1044 | Does not require authentication for Mastodon versions after 2.7.0 (returns | 1080 | Does not require authentication for Mastodon versions after 2.7.0 (returns |
1045 | publicly visible statuses in that case), for publicly visible accounts. | 1081 | publicly visible statuses in that case), for publicly visible accounts. |
@@ -1063,7 +1099,9 @@ class Mastodon: | |||
1063 | del params["only_media"] | 1099 | del params["only_media"] |
1064 | if exclude_replies == False: | 1100 | if exclude_replies == False: |
1065 | del params["exclude_replies"] | 1101 | del params["exclude_replies"] |
1066 | 1102 | if exclude_reblogs == False: | |
1103 | del params["exclude_reblogs"] | ||
1104 | |||
1067 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) | 1105 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) |
1068 | return self.__api_request('GET', url, params) | 1106 | return self.__api_request('GET', url, params) |
1069 | 1107 | ||
@@ -1633,13 +1671,23 @@ class Mastodon: | |||
1633 | # Reading data: Bookmarks | 1671 | # Reading data: Bookmarks |
1634 | ### | 1672 | ### |
1635 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) | 1673 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) |
1636 | def bookmarks(self): | 1674 | def bookmarks(self, max_id=None, min_id=None, since_id=None, limit=None): |
1637 | """ | 1675 | """ |
1638 | Get a list of statuses bookmarked by the logged-in user. | 1676 | Get a list of statuses bookmarked by the logged-in user. |
1639 | 1677 | ||
1640 | Returns a list of `toot dicts`_. | 1678 | Returns a list of `toot dicts`_. |
1641 | """ | 1679 | """ |
1642 | return self.__api_request('GET', '/api/v1/bookmarks') | 1680 | if max_id != None: |
1681 | max_id = self.__unpack_id(max_id) | ||
1682 | |||
1683 | if min_id != None: | ||
1684 | min_id = self.__unpack_id(min_id) | ||
1685 | |||
1686 | if since_id != None: | ||
1687 | since_id = self.__unpack_id(since_id) | ||
1688 | |||
1689 | params = self.__generate_params(locals()) | ||
1690 | return self.__api_request('GET', '/api/v1/bookmarks', params) | ||
1643 | 1691 | ||
1644 | ### | 1692 | ### |
1645 | # Writing data: Statuses | 1693 | # Writing data: Statuses |
@@ -2424,7 +2472,7 @@ class Mastodon: | |||
2424 | if not status_ids is None: | 2472 | if not status_ids is None: |
2425 | if not isinstance(status_ids, list): | 2473 | if not isinstance(status_ids, list): |
2426 | status_ids = [status_ids] | 2474 | status_ids = [status_ids] |
2427 | status_ids = list(map(lambda x: self.__unpack_id(x), status_ids)) | 2475 | status_ids = list(map(lambda x: self.__unpack_id(x), status_ids)) |
2428 | 2476 | ||
2429 | params_initial = locals() | 2477 | params_initial = locals() |
2430 | if forward == False: | 2478 | if forward == False: |
@@ -3041,8 +3089,8 @@ class Mastodon: | |||
3041 | Returns the next page or None if no further data is available. | 3089 | Returns the next page or None if no further data is available. |
3042 | """ | 3090 | """ |
3043 | if isinstance(previous_page, list) and len(previous_page) != 0: | 3091 | if isinstance(previous_page, list) and len(previous_page) != 0: |
3044 | if hasattr(previous_page[-1], '_pagination_next'): | 3092 | if hasattr(previous_page, '_pagination_next'): |
3045 | params = copy.deepcopy(previous_page[-1]._pagination_next) | 3093 | params = copy.deepcopy(previous_page._pagination_next) |
3046 | else: | 3094 | else: |
3047 | return None | 3095 | return None |
3048 | else: | 3096 | else: |
@@ -3065,8 +3113,8 @@ class Mastodon: | |||
3065 | Returns the previous page or None if no further data is available. | 3113 | Returns the previous page or None if no further data is available. |
3066 | """ | 3114 | """ |
3067 | if isinstance(next_page, list) and len(next_page) != 0: | 3115 | if isinstance(next_page, list) and len(next_page) != 0: |
3068 | if hasattr(next_page[0], '_pagination_prev'): | 3116 | if hasattr(next_page, '_pagination_prev'): |
3069 | params = copy.deepcopy(next_page[0]._pagination_prev) | 3117 | params = copy.deepcopy(next_page._pagination_prev) |
3070 | else: | 3118 | else: |
3071 | return None | 3119 | return None |
3072 | else: | 3120 | else: |
@@ -3231,7 +3279,7 @@ class Mastodon: | |||
3231 | if (key in json_object and isinstance(json_object[key], six.text_type)): | 3279 | if (key in json_object and isinstance(json_object[key], six.text_type)): |
3232 | if json_object[key].lower() == 'true': | 3280 | if json_object[key].lower() == 'true': |
3233 | json_object[key] = True | 3281 | json_object[key] = True |
3234 | if json_object[key].lower() == 'False': | 3282 | if json_object[key].lower() == 'false': |
3235 | json_object[key] = False | 3283 | json_object[key] = False |
3236 | return json_object | 3284 | return json_object |
3237 | 3285 | ||
@@ -3305,6 +3353,10 @@ class Mastodon: | |||
3305 | if not access_token_override is None: | 3353 | if not access_token_override is None: |
3306 | headers['Authorization'] = 'Bearer ' + access_token_override | 3354 | headers['Authorization'] = 'Bearer ' + access_token_override |
3307 | 3355 | ||
3356 | # Add user-agent | ||
3357 | if self.user_agent: | ||
3358 | headers['User-Agent'] = self.user_agent | ||
3359 | |||
3308 | # Determine base URL | 3360 | # Determine base URL |
3309 | base_url = self.api_base_url | 3361 | base_url = self.api_base_url |
3310 | if not base_url_override is None: | 3362 | if not base_url_override is None: |
@@ -3356,8 +3408,11 @@ class Mastodon: | |||
3356 | self.ratelimit_limit = int(response_object.headers['X-RateLimit-Limit']) | 3408 | self.ratelimit_limit = int(response_object.headers['X-RateLimit-Limit']) |
3357 | 3409 | ||
3358 | try: | 3410 | try: |
3359 | ratelimit_reset_datetime = dateutil.parser.parse(response_object.headers['X-RateLimit-Reset']) | 3411 | if str(int(response_object.headers['X-RateLimit-Reset'])) == response_object.headers['X-RateLimit-Reset']: |
3360 | self.ratelimit_reset = self.__datetime_to_epoch(ratelimit_reset_datetime) | 3412 | self.ratelimit_reset = int(response_object.headers['X-RateLimit-Reset']) |
3413 | else: | ||
3414 | ratelimit_reset_datetime = dateutil.parser.parse(response_object.headers['X-RateLimit-Reset']) | ||
3415 | self.ratelimit_reset = self.__datetime_to_epoch(ratelimit_reset_datetime) | ||
3361 | 3416 | ||
3362 | # Adjust server time to local clock | 3417 | # Adjust server time to local clock |
3363 | if 'Date' in response_object.headers: | 3418 | if 'Date' in response_object.headers: |
@@ -3444,6 +3499,7 @@ class Mastodon: | |||
3444 | if isinstance(response, list) and \ | 3499 | if isinstance(response, list) and \ |
3445 | 'Link' in response_object.headers and \ | 3500 | 'Link' in response_object.headers and \ |
3446 | response_object.headers['Link'] != "": | 3501 | response_object.headers['Link'] != "": |
3502 | response = AttribAccessList(response) | ||
3447 | tmp_urls = requests.utils.parse_header_links( | 3503 | tmp_urls = requests.utils.parse_header_links( |
3448 | response_object.headers['Link'].rstrip('>').replace('>,<', ',<')) | 3504 | response_object.headers['Link'].rstrip('>').replace('>,<', ',<')) |
3449 | for url in tmp_urls: | 3505 | for url in tmp_urls: |
@@ -3468,7 +3524,12 @@ class Mastodon: | |||
3468 | del next_params['since_id'] | 3524 | del next_params['since_id'] |
3469 | if "min_id" in next_params: | 3525 | if "min_id" in next_params: |
3470 | del next_params['min_id'] | 3526 | del next_params['min_id'] |
3471 | response[-1]._pagination_next = next_params | 3527 | response._pagination_next = next_params |
3528 | |||
3529 | # Maybe other API users rely on the pagination info in the last item | ||
3530 | # Will be removed in future | ||
3531 | if isinstance(response[-1], AttribAccessDict): | ||
3532 | response[-1]._pagination_next = next_params | ||
3472 | 3533 | ||
3473 | if url['rel'] == 'prev': | 3534 | if url['rel'] == 'prev': |
3474 | # Be paranoid and extract since_id or min_id specifically | 3535 | # Be paranoid and extract since_id or min_id specifically |
@@ -3487,8 +3548,13 @@ class Mastodon: | |||
3487 | prev_params['since_id'] = since_id | 3548 | prev_params['since_id'] = since_id |
3488 | if "max_id" in prev_params: | 3549 | if "max_id" in prev_params: |
3489 | del prev_params['max_id'] | 3550 | del prev_params['max_id'] |
3490 | response[0]._pagination_prev = prev_params | 3551 | response._pagination_prev = prev_params |
3491 | 3552 | ||
3553 | # Maybe other API users rely on the pagination info in the first item | ||
3554 | # Will be removed in future | ||
3555 | if isinstance(response[0], AttribAccessDict): | ||
3556 | response[0]._pagination_prev = prev_params | ||
3557 | |||
3492 | # New and fantastico (post-2.6.0): min_id pagination | 3558 | # New and fantastico (post-2.6.0): min_id pagination |
3493 | matchgroups = re.search(r"[?&]min_id=([^&]+)", prev_url) | 3559 | matchgroups = re.search(r"[?&]min_id=([^&]+)", prev_url) |
3494 | if matchgroups: | 3560 | if matchgroups: |
@@ -3502,7 +3568,12 @@ class Mastodon: | |||
3502 | prev_params['min_id'] = min_id | 3568 | prev_params['min_id'] = min_id |
3503 | if "max_id" in prev_params: | 3569 | if "max_id" in prev_params: |
3504 | del prev_params['max_id'] | 3570 | del prev_params['max_id'] |
3505 | response[0]._pagination_prev = prev_params | 3571 | response._pagination_prev = prev_params |
3572 | |||
3573 | # Maybe other API users rely on the pagination info in the first item | ||
3574 | # Will be removed in future | ||
3575 | if isinstance(response[0], AttribAccessDict): | ||
3576 | response[0]._pagination_prev = prev_params | ||
3506 | 3577 | ||
3507 | return response | 3578 | return response |
3508 | 3579 | ||
@@ -3547,6 +3618,8 @@ class Mastodon: | |||
3547 | # Connect function (called and then potentially passed to async handler) | 3618 | # Connect function (called and then potentially passed to async handler) |
3548 | def connect_func(): | 3619 | def connect_func(): |
3549 | headers = {"Authorization": "Bearer " + self.access_token} if self.access_token else {} | 3620 | headers = {"Authorization": "Bearer " + self.access_token} if self.access_token else {} |
3621 | if self.user_agent: | ||
3622 | headers['User-Agent'] = self.user_agent | ||
3550 | connection = self.session.get(url + endpoint, headers = headers, data = params, stream = True, | 3623 | connection = self.session.get(url + endpoint, headers = headers, data = params, stream = True, |
3551 | timeout=(self.request_timeout, timeout)) | 3624 | timeout=(self.request_timeout, timeout)) |
3552 | 3625 | ||
@@ -3568,7 +3641,8 @@ class Mastodon: | |||
3568 | 3641 | ||
3569 | def close(self): | 3642 | def close(self): |
3570 | self.closed = True | 3643 | self.closed = True |
3571 | self.connection.close() | 3644 | if not self.connection is None: |
3645 | self.connection.close() | ||
3572 | 3646 | ||
3573 | def is_alive(self): | 3647 | def is_alive(self): |
3574 | return self._thread.is_alive() | 3648 | return self._thread.is_alive() |
@@ -3579,6 +3653,14 @@ class Mastodon: | |||
3579 | else: | 3653 | else: |
3580 | return True | 3654 | return True |
3581 | 3655 | ||
3656 | def _sleep_attentive(self): | ||
3657 | if self._thread != threading.current_thread(): | ||
3658 | raise RuntimeError ("Illegal call from outside the stream_handle thread") | ||
3659 | time_remaining = self.reconnect_async_wait_sec | ||
3660 | while time_remaining>0 and not self.closed: | ||
3661 | time.sleep(0.5) | ||
3662 | time_remaining -= 0.5 | ||
3663 | |||
3582 | def _threadproc(self): | 3664 | def _threadproc(self): |
3583 | self._thread = threading.current_thread() | 3665 | self._thread = threading.current_thread() |
3584 | 3666 | ||
@@ -3600,16 +3682,26 @@ class Mastodon: | |||
3600 | self.reconnecting = True | 3682 | self.reconnecting = True |
3601 | connect_success = False | 3683 | connect_success = False |
3602 | while not connect_success: | 3684 | while not connect_success: |
3603 | connect_success = True | 3685 | if self.closed: |
3686 | # Someone from outside stopped the streaming | ||
3687 | self.running = False | ||
3688 | break | ||
3604 | try: | 3689 | try: |
3605 | self.connection = self.connect_func() | 3690 | the_connection = self.connect_func() |
3606 | if self.connection.status_code != 200: | 3691 | if the_connection.status_code != 200: |
3607 | time.sleep(self.reconnect_async_wait_sec) | 3692 | exception = MastodonNetworkError(f"Could not connect to server. " |
3608 | connect_success = False | 3693 | f"HTTP status: {the_connection.status_code}") |
3609 | exception = MastodonNetworkError("Could not connect to server.") | ||
3610 | listener.on_abort(exception) | 3694 | listener.on_abort(exception) |
3695 | self._sleep_attentive() | ||
3696 | if self.closed: | ||
3697 | # Here we have maybe a rare race condition. Exactly on connect, someone | ||
3698 | # stopped the streaming before. We close the previous established connection: | ||
3699 | the_connection.close() | ||
3700 | else: | ||
3701 | self.connection = the_connection | ||
3702 | connect_success = True | ||
3611 | except: | 3703 | except: |
3612 | time.sleep(self.reconnect_async_wait_sec) | 3704 | self._sleep_attentive() |
3613 | connect_success = False | 3705 | connect_success = False |
3614 | self.reconnecting = False | 3706 | self.reconnecting = False |
3615 | else: | 3707 | else: |
diff --git a/mastodon/streaming.py b/mastodon/streaming.py index 214ed1c..ceb61ea 100644 --- a/mastodon/streaming.py +++ b/mastodon/streaming.py | |||
@@ -45,6 +45,16 @@ class StreamListener(object): | |||
45 | contains the resulting conversation dict.""" | 45 | contains the resulting conversation dict.""" |
46 | pass | 46 | pass |
47 | 47 | ||
48 | def on_unknown_event(self, name, unknown_event = None): | ||
49 | """An unknown mastodon API event has been received. The name contains the event-name and unknown_event | ||
50 | contains the content of the unknown event. | ||
51 | |||
52 | This function must be implemented, if unknown events should be handled without an error. | ||
53 | """ | ||
54 | exception = MastodonMalformedEventError('Bad event type', name) | ||
55 | self.on_abort(exception) | ||
56 | raise exception | ||
57 | |||
48 | def handle_heartbeat(self): | 58 | def handle_heartbeat(self): |
49 | """The server has sent us a keep-alive message. This callback may be | 59 | """The server has sent us a keep-alive message. This callback may be |
50 | useful to carry out periodic housekeeping tasks, or just to confirm | 60 | useful to carry out periodic housekeeping tasks, or just to confirm |
@@ -56,6 +66,11 @@ class StreamListener(object): | |||
56 | Handles a stream of events from the Mastodon server. When each event | 66 | Handles a stream of events from the Mastodon server. When each event |
57 | is received, the corresponding .on_[name]() method is called. | 67 | is received, the corresponding .on_[name]() method is called. |
58 | 68 | ||
69 | When the Mastodon API changes, the on_unknown_event(name, content) | ||
70 | function is called. | ||
71 | The default behavior is to throw an error. Define a callback handler | ||
72 | to intercept unknown events if needed (and avoid errors) | ||
73 | |||
59 | response; a requests response object with the open stream for reading. | 74 | response; a requests response object with the open stream for reading. |
60 | """ | 75 | """ |
61 | event = {} | 76 | event = {} |
@@ -137,33 +152,32 @@ class StreamListener(object): | |||
137 | exception, | 152 | exception, |
138 | err | 153 | err |
139 | ) | 154 | ) |
140 | 155 | # New mastodon API also supports event names with dots: | |
141 | handler_name = 'on_' + name | 156 | handler_name = 'on_' + name.replace('.', '_') |
142 | try: | 157 | # A generic way to handle unknown events to make legacy code more stable for future changes |
143 | handler = getattr(self, handler_name) | 158 | handler = getattr(self, handler_name, self.on_unknown_event) |
144 | except AttributeError as err: | 159 | if handler != self.on_unknown_event: |
145 | exception = MastodonMalformedEventError('Bad event type', name) | ||
146 | self.on_abort(exception) | ||
147 | six.raise_from( | ||
148 | exception, | ||
149 | err | ||
150 | ) | ||
151 | else: | ||
152 | handler(payload) | 160 | handler(payload) |
161 | else: | ||
162 | handler(name, payload) | ||
163 | |||
153 | 164 | ||
154 | class CallbackStreamListener(StreamListener): | 165 | class CallbackStreamListener(StreamListener): |
155 | """ | 166 | """ |
156 | Simple callback stream handler class. | 167 | Simple callback stream handler class. |
157 | Can optionally additionally send local update events to a separate handler. | 168 | Can optionally additionally send local update events to a separate handler. |
169 | Define an unknown_event_handler for new Mastodon API events. If not, the | ||
170 | listener will raise an error on new, not handled, events from the API. | ||
158 | """ | 171 | """ |
159 | def __init__(self, update_handler = None, local_update_handler = None, delete_handler = None, notification_handler = None, conversation_handler = None): | 172 | def __init__(self, update_handler = None, local_update_handler = None, delete_handler = None, notification_handler = None, conversation_handler = None, unknown_event_handler = None): |
160 | super(CallbackStreamListener, self).__init__() | 173 | super(CallbackStreamListener, self).__init__() |
161 | self.update_handler = update_handler | 174 | self.update_handler = update_handler |
162 | self.local_update_handler = local_update_handler | 175 | self.local_update_handler = local_update_handler |
163 | self.delete_handler = delete_handler | 176 | self.delete_handler = delete_handler |
164 | self.notification_handler = notification_handler | 177 | self.notification_handler = notification_handler |
165 | self.conversation_handler = conversation_handler | 178 | self.conversation_handler = conversation_handler |
166 | 179 | self.unknown_event_handler = unknown_event_handler | |
180 | |||
167 | def on_update(self, status): | 181 | def on_update(self, status): |
168 | if self.update_handler != None: | 182 | if self.update_handler != None: |
169 | self.update_handler(status) | 183 | self.update_handler(status) |
@@ -188,3 +202,11 @@ class CallbackStreamListener(StreamListener): | |||
188 | def on_conversation(self, conversation): | 202 | def on_conversation(self, conversation): |
189 | if self.conversation_handler != None: | 203 | if self.conversation_handler != None: |
190 | self.conversation_handler(conversation) | 204 | self.conversation_handler(conversation) |
205 | |||
206 | def on_unknown_event(self, name, unknown_event = None): | ||
207 | if self.unknown_event_handler != None: | ||
208 | self.unknown_event_handler(name, unknown_event) | ||
209 | else: | ||
210 | exception = MastodonMalformedEventError('Bad event type', name) | ||
211 | self.on_abort(exception) | ||
212 | raise exception | ||
diff --git a/tests/README.markdown b/tests/README.markdown index 368f4f5..62b5e10 100644 --- a/tests/README.markdown +++ b/tests/README.markdown | |||
@@ -26,7 +26,7 @@ This test suite uses [VCR.py][] to record requests to Mastodon and replay them i | |||
26 | If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password. | 26 | If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password. |
27 | To set this up, follow the development guide and set up the database using "rails db:setup". | 27 | To set this up, follow the development guide and set up the database using "rails db:setup". |
28 | 28 | ||
29 | It also needs a test OAuth app and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database: | 29 | It also needs a test OAuth app-registriation and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database: |
30 | 30 | ||
31 | psql -d mastodon_development < tests/setup.sql | 31 | psql -d mastodon_development < tests/setup.sql |
32 | 32 | ||
diff --git a/tests/cassettes/test_bookmarks.yaml b/tests/cassettes/test_bookmarks.yaml index c2bee19..de9c314 100644 --- a/tests/cassettes/test_bookmarks.yaml +++ b/tests/cassettes/test_bookmarks.yaml | |||
@@ -2,174 +2,441 @@ interactions: | |||
2 | - request: | 2 | - request: |
3 | body: status=Toot%21 | 3 | body: status=Toot%21 |
4 | headers: | 4 | headers: |
5 | Accept: ['*/*'] | 5 | Accept: |
6 | Accept-Encoding: ['gzip, deflate'] | 6 | - '*/*' |
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 7 | Accept-Encoding: |
8 | Connection: [keep-alive] | 8 | - gzip, deflate |
9 | Content-Length: ['14'] | 9 | Authorization: |
10 | Content-Type: [application/x-www-form-urlencoded] | 10 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
11 | User-Agent: [python-requests/2.18.4] | 11 | Connection: |
12 | - keep-alive | ||
13 | Content-Length: | ||
14 | - '14' | ||
15 | Content-Type: | ||
16 | - application/x-www-form-urlencoded | ||
17 | User-Agent: | ||
18 | - python-requests/2.22.0 | ||
12 | method: POST | 19 | method: POST |
13 | uri: http://localhost:3000/api/v1/statuses | 20 | uri: http://localhost:3000/api/v1/statuses |
14 | response: | 21 | response: |
15 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 22 | body: |
16 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 23 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
24 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
17 | headers: | 25 | headers: |
18 | Cache-Control: ['no-cache, no-store'] | 26 | Cache-Control: |
19 | Content-Type: [application/json; charset=utf-8] | 27 | - no-store |
20 | Referrer-Policy: [strict-origin-when-cross-origin] | 28 | Content-Security-Policy: |
21 | Transfer-Encoding: [chunked] | 29 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
22 | Vary: ['Accept-Encoding, Origin'] | 30 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
23 | X-Content-Type-Options: [nosniff] | 31 | style-src ''self'' http://localhost ''nonce-s4DtHaGKm+Sv7S0opGjkuA==''; media-src |
24 | X-Download-Options: [noopen] | 32 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
25 | X-Frame-Options: [SAMEORIGIN] | 33 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
26 | X-Permitted-Cross-Domain-Policies: [none] | 34 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
27 | X-Request-Id: [4c259279-4810-4065-bda7-44fdd2e5e769] | 35 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
28 | X-Runtime: ['0.160125'] | 36 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
29 | X-XSS-Protection: [1; mode=block] | 37 | Content-Type: |
30 | content-length: ['1320'] | 38 | - application/json; charset=utf-8 |
31 | status: {code: 200, message: OK} | 39 | ETag: |
40 | - W/"16c19c98c5667003bada6cc08d6a9efd" | ||
41 | Referrer-Policy: | ||
42 | - strict-origin-when-cross-origin | ||
43 | Transfer-Encoding: | ||
44 | - chunked | ||
45 | Vary: | ||
46 | - Accept, Accept-Encoding, Origin | ||
47 | X-Content-Type-Options: | ||
48 | - nosniff | ||
49 | X-Download-Options: | ||
50 | - noopen | ||
51 | X-Frame-Options: | ||
52 | - SAMEORIGIN | ||
53 | X-Permitted-Cross-Domain-Policies: | ||
54 | - none | ||
55 | X-RateLimit-Limit: | ||
56 | - '300' | ||
57 | X-RateLimit-Remaining: | ||
58 | - '290' | ||
59 | X-RateLimit-Reset: | ||
60 | - '2022-06-24T15:00:00.156190Z' | ||
61 | X-Request-Id: | ||
62 | - a38516b7-de3e-4c49-9405-0bded1f29145 | ||
63 | X-Runtime: | ||
64 | - '0.047610' | ||
65 | X-XSS-Protection: | ||
66 | - 1; mode=block | ||
67 | content-length: | ||
68 | - '1308' | ||
69 | status: | ||
70 | code: 200 | ||
71 | message: OK | ||
32 | - request: | 72 | - request: |
33 | body: null | 73 | body: null |
34 | headers: | 74 | headers: |
35 | Accept: ['*/*'] | 75 | Accept: |
36 | Accept-Encoding: ['gzip, deflate'] | 76 | - '*/*' |
37 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 77 | Accept-Encoding: |
38 | Connection: [keep-alive] | 78 | - gzip, deflate |
39 | Content-Length: ['0'] | 79 | Authorization: |
40 | User-Agent: [python-requests/2.18.4] | 80 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
81 | Connection: | ||
82 | - keep-alive | ||
83 | Content-Length: | ||
84 | - '0' | ||
85 | User-Agent: | ||
86 | - python-requests/2.22.0 | ||
41 | method: POST | 87 | method: POST |
42 | uri: http://localhost:3000/api/v1/statuses/103704183225122470/bookmark | 88 | uri: http://localhost:3000/api/v1/statuses/108532515807337403/bookmark |
43 | response: | 89 | response: |
44 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 90 | body: |
45 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 91 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
92 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
46 | headers: | 93 | headers: |
47 | Cache-Control: ['no-cache, no-store'] | 94 | Cache-Control: |
48 | Content-Type: [application/json; charset=utf-8] | 95 | - no-store |
49 | Referrer-Policy: [strict-origin-when-cross-origin] | 96 | Content-Security-Policy: |
50 | Transfer-Encoding: [chunked] | 97 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
51 | Vary: ['Accept-Encoding, Origin'] | 98 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
52 | X-Content-Type-Options: [nosniff] | 99 | style-src ''self'' http://localhost ''nonce-r/DodIkic+v9H9lAcksQVw==''; media-src |
53 | X-Download-Options: [noopen] | 100 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
54 | X-Frame-Options: [SAMEORIGIN] | 101 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
55 | X-Permitted-Cross-Domain-Policies: [none] | 102 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
56 | X-Request-Id: [a0ef24c0-bc8d-45ef-80af-0737f40f4191] | 103 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
57 | X-Runtime: ['0.157864'] | 104 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
58 | X-XSS-Protection: [1; mode=block] | 105 | Content-Type: |
59 | content-length: ['1319'] | 106 | - application/json; charset=utf-8 |
60 | status: {code: 200, message: OK} | 107 | ETag: |
108 | - W/"bb1e121980e105d13ea65b61a8fe3f9e" | ||
109 | Referrer-Policy: | ||
110 | - strict-origin-when-cross-origin | ||
111 | Transfer-Encoding: | ||
112 | - chunked | ||
113 | Vary: | ||
114 | - Accept, Accept-Encoding, Origin | ||
115 | X-Content-Type-Options: | ||
116 | - nosniff | ||
117 | X-Download-Options: | ||
118 | - noopen | ||
119 | X-Frame-Options: | ||
120 | - SAMEORIGIN | ||
121 | X-Permitted-Cross-Domain-Policies: | ||
122 | - none | ||
123 | X-Request-Id: | ||
124 | - 4af13637-38f4-41d6-ad47-756de2626bf3 | ||
125 | X-Runtime: | ||
126 | - '0.041993' | ||
127 | X-XSS-Protection: | ||
128 | - 1; mode=block | ||
129 | content-length: | ||
130 | - '1307' | ||
131 | status: | ||
132 | code: 200 | ||
133 | message: OK | ||
61 | - request: | 134 | - request: |
62 | body: null | 135 | body: null |
63 | headers: | 136 | headers: |
64 | Accept: ['*/*'] | 137 | Accept: |
65 | Accept-Encoding: ['gzip, deflate'] | 138 | - '*/*' |
66 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 139 | Accept-Encoding: |
67 | Connection: [keep-alive] | 140 | - gzip, deflate |
68 | User-Agent: [python-requests/2.18.4] | 141 | Authorization: |
142 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
143 | Connection: | ||
144 | - keep-alive | ||
145 | User-Agent: | ||
146 | - python-requests/2.22.0 | ||
69 | method: GET | 147 | method: GET |
70 | uri: http://localhost:3000/api/v1/bookmarks | 148 | uri: http://localhost:3000/api/v1/bookmarks |
71 | response: | 149 | response: |
72 | body: {string: '[{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 150 | body: |
73 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} | 151 | string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
152 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
74 | headers: | 153 | headers: |
75 | Cache-Control: ['no-cache, no-store'] | 154 | Cache-Control: |
76 | Content-Type: [application/json; charset=utf-8] | 155 | - no-store |
77 | Link: ['<http://localhost:3000/api/v1/bookmarks?min_id=2>; rel="prev"'] | 156 | Content-Security-Policy: |
78 | Referrer-Policy: [strict-origin-when-cross-origin] | 157 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
79 | Transfer-Encoding: [chunked] | 158 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
80 | Vary: ['Accept-Encoding, Origin'] | 159 | style-src ''self'' http://localhost ''nonce-EEFQZtT2hj45UYMa5FifxA==''; media-src |
81 | X-Content-Type-Options: [nosniff] | 160 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
82 | X-Download-Options: [noopen] | 161 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
83 | X-Frame-Options: [SAMEORIGIN] | 162 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
84 | X-Permitted-Cross-Domain-Policies: [none] | 163 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
85 | X-Request-Id: [e6548f1e-3d17-46be-aca7-f310783119a8] | 164 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
86 | X-Runtime: ['0.075518'] | 165 | Content-Type: |
87 | X-XSS-Protection: [1; mode=block] | 166 | - application/json; charset=utf-8 |
88 | content-length: ['1321'] | 167 | ETag: |
89 | status: {code: 200, message: OK} | 168 | - W/"e28cea671d77758e8cd2652347a030d1" |
169 | Link: | ||
170 | - <http://localhost:3000/api/v1/bookmarks?min_id=11>; rel="prev" | ||
171 | Referrer-Policy: | ||
172 | - strict-origin-when-cross-origin | ||
173 | Transfer-Encoding: | ||
174 | - chunked | ||
175 | Vary: | ||
176 | - Accept, Accept-Encoding, Origin | ||
177 | X-Content-Type-Options: | ||
178 | - nosniff | ||
179 | X-Download-Options: | ||
180 | - noopen | ||
181 | X-Frame-Options: | ||
182 | - SAMEORIGIN | ||
183 | X-Permitted-Cross-Domain-Policies: | ||
184 | - none | ||
185 | X-Request-Id: | ||
186 | - 0fe7aaf8-add4-4523-a98f-22608f714cad | ||
187 | X-Runtime: | ||
188 | - '0.036771' | ||
189 | X-XSS-Protection: | ||
190 | - 1; mode=block | ||
191 | content-length: | ||
192 | - '1309' | ||
193 | status: | ||
194 | code: 200 | ||
195 | message: OK | ||
90 | - request: | 196 | - request: |
91 | body: null | 197 | body: null |
92 | headers: | 198 | headers: |
93 | Accept: ['*/*'] | 199 | Accept: |
94 | Accept-Encoding: ['gzip, deflate'] | 200 | - '*/*' |
95 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 201 | Accept-Encoding: |
96 | Connection: [keep-alive] | 202 | - gzip, deflate |
97 | Content-Length: ['0'] | 203 | Authorization: |
98 | User-Agent: [python-requests/2.18.4] | 204 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
205 | Connection: | ||
206 | - keep-alive | ||
207 | User-Agent: | ||
208 | - python-requests/2.22.0 | ||
209 | method: GET | ||
210 | uri: http://localhost:3000/api/v1/bookmarks?limit=1 | ||
211 | response: | ||
212 | body: | ||
213 | string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
214 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
215 | headers: | ||
216 | Cache-Control: | ||
217 | - no-store | ||
218 | Content-Security-Policy: | ||
219 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
220 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; | ||
221 | style-src ''self'' http://localhost ''nonce-wzGUumpjXwVRz6YQjB+AhQ==''; media-src | ||
222 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src | ||
223 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost | ||
224 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; | ||
225 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src | ||
226 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' | ||
227 | Content-Type: | ||
228 | - application/json; charset=utf-8 | ||
229 | ETag: | ||
230 | - W/"e28cea671d77758e8cd2652347a030d1" | ||
231 | Link: | ||
232 | - <http://localhost:3000/api/v1/bookmarks?limit=1&max_id=11>; rel="next", <http://localhost:3000/api/v1/bookmarks?limit=1&min_id=11>; | ||
233 | rel="prev" | ||
234 | Referrer-Policy: | ||
235 | - strict-origin-when-cross-origin | ||
236 | Transfer-Encoding: | ||
237 | - chunked | ||
238 | Vary: | ||
239 | - Accept, Accept-Encoding, Origin | ||
240 | X-Content-Type-Options: | ||
241 | - nosniff | ||
242 | X-Download-Options: | ||
243 | - noopen | ||
244 | X-Frame-Options: | ||
245 | - SAMEORIGIN | ||
246 | X-Permitted-Cross-Domain-Policies: | ||
247 | - none | ||
248 | X-Request-Id: | ||
249 | - 7c887921-a7ee-478d-8e68-61359f4eacaf | ||
250 | X-Runtime: | ||
251 | - '0.037690' | ||
252 | X-XSS-Protection: | ||
253 | - 1; mode=block | ||
254 | content-length: | ||
255 | - '1309' | ||
256 | status: | ||
257 | code: 200 | ||
258 | message: OK | ||
259 | - request: | ||
260 | body: null | ||
261 | headers: | ||
262 | Accept: | ||
263 | - '*/*' | ||
264 | Accept-Encoding: | ||
265 | - gzip, deflate | ||
266 | Authorization: | ||
267 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
268 | Connection: | ||
269 | - keep-alive | ||
270 | Content-Length: | ||
271 | - '0' | ||
272 | User-Agent: | ||
273 | - python-requests/2.22.0 | ||
99 | method: POST | 274 | method: POST |
100 | uri: http://localhost:3000/api/v1/statuses/103704183225122470/unbookmark | 275 | uri: http://localhost:3000/api/v1/statuses/108532515807337403/unbookmark |
101 | response: | 276 | response: |
102 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 277 | body: |
103 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 278 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
279 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
104 | headers: | 280 | headers: |
105 | Cache-Control: ['no-cache, no-store'] | 281 | Cache-Control: |
106 | Content-Type: [application/json; charset=utf-8] | 282 | - no-store |
107 | Referrer-Policy: [strict-origin-when-cross-origin] | 283 | Content-Security-Policy: |
108 | Transfer-Encoding: [chunked] | 284 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
109 | Vary: ['Accept-Encoding, Origin'] | 285 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
110 | X-Content-Type-Options: [nosniff] | 286 | style-src ''self'' http://localhost ''nonce-x2CjCkxjnkvgJiPtS/CoIg==''; media-src |
111 | X-Download-Options: [noopen] | 287 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
112 | X-Frame-Options: [SAMEORIGIN] | 288 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
113 | X-Permitted-Cross-Domain-Policies: [none] | 289 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
114 | X-Request-Id: [d9792c38-ab1e-46de-9737-704433ad8f94] | 290 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
115 | X-Runtime: ['0.095876'] | 291 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
116 | X-XSS-Protection: [1; mode=block] | 292 | Content-Type: |
117 | content-length: ['1320'] | 293 | - application/json; charset=utf-8 |
118 | status: {code: 200, message: OK} | 294 | ETag: |
295 | - W/"16c19c98c5667003bada6cc08d6a9efd" | ||
296 | Referrer-Policy: | ||
297 | - strict-origin-when-cross-origin | ||
298 | Transfer-Encoding: | ||
299 | - chunked | ||
300 | Vary: | ||
301 | - Accept, Accept-Encoding, Origin | ||
302 | X-Content-Type-Options: | ||
303 | - nosniff | ||
304 | X-Download-Options: | ||
305 | - noopen | ||
306 | X-Frame-Options: | ||
307 | - SAMEORIGIN | ||
308 | X-Permitted-Cross-Domain-Policies: | ||
309 | - none | ||
310 | X-Request-Id: | ||
311 | - 61142a88-6453-47c6-8230-6b6196efb64c | ||
312 | X-Runtime: | ||
313 | - '0.035340' | ||
314 | X-XSS-Protection: | ||
315 | - 1; mode=block | ||
316 | content-length: | ||
317 | - '1308' | ||
318 | status: | ||
319 | code: 200 | ||
320 | message: OK | ||
119 | - request: | 321 | - request: |
120 | body: null | 322 | body: null |
121 | headers: | 323 | headers: |
122 | Accept: ['*/*'] | 324 | Accept: |
123 | Accept-Encoding: ['gzip, deflate'] | 325 | - '*/*' |
124 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 326 | Accept-Encoding: |
125 | Connection: [keep-alive] | 327 | - gzip, deflate |
126 | User-Agent: [python-requests/2.18.4] | 328 | Authorization: |
329 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
330 | Connection: | ||
331 | - keep-alive | ||
332 | User-Agent: | ||
333 | - python-requests/2.22.0 | ||
127 | method: GET | 334 | method: GET |
128 | uri: http://localhost:3000/api/v1/bookmarks | 335 | uri: http://localhost:3000/api/v1/bookmarks |
129 | response: | 336 | response: |
130 | body: {string: '[]'} | 337 | body: |
338 | string: '[]' | ||
131 | headers: | 339 | headers: |
132 | Cache-Control: ['no-cache, no-store'] | 340 | Cache-Control: |
133 | Content-Type: [application/json; charset=utf-8] | 341 | - no-store |
134 | Referrer-Policy: [strict-origin-when-cross-origin] | 342 | Content-Security-Policy: |
135 | Transfer-Encoding: [chunked] | 343 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
136 | Vary: ['Accept-Encoding, Origin'] | 344 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
137 | X-Content-Type-Options: [nosniff] | 345 | style-src ''self'' http://localhost ''nonce-i6oSjmQ5IE8wtOR+vDrGZw==''; media-src |
138 | X-Download-Options: [noopen] | 346 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
139 | X-Frame-Options: [SAMEORIGIN] | 347 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
140 | X-Permitted-Cross-Domain-Policies: [none] | 348 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
141 | X-Request-Id: [8454c5ef-5f23-43b9-89d8-dc1b1605f7ac] | 349 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
142 | X-Runtime: ['0.035375'] | 350 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
143 | X-XSS-Protection: [1; mode=block] | 351 | Content-Type: |
144 | content-length: ['2'] | 352 | - application/json; charset=utf-8 |
145 | status: {code: 200, message: OK} | 353 | ETag: |
354 | - W/"aaa12070e167024a89ca985596a44579" | ||
355 | Referrer-Policy: | ||
356 | - strict-origin-when-cross-origin | ||
357 | Transfer-Encoding: | ||
358 | - chunked | ||
359 | Vary: | ||
360 | - Accept, Accept-Encoding, Origin | ||
361 | X-Content-Type-Options: | ||
362 | - nosniff | ||
363 | X-Download-Options: | ||
364 | - noopen | ||
365 | X-Frame-Options: | ||
366 | - SAMEORIGIN | ||
367 | X-Permitted-Cross-Domain-Policies: | ||
368 | - none | ||
369 | X-Request-Id: | ||
370 | - 639bbb25-65a5-44eb-a886-d7092f891ecb | ||
371 | X-Runtime: | ||
372 | - '0.014781' | ||
373 | X-XSS-Protection: | ||
374 | - 1; mode=block | ||
375 | content-length: | ||
376 | - '2' | ||
377 | status: | ||
378 | code: 200 | ||
379 | message: OK | ||
146 | - request: | 380 | - request: |
147 | body: null | 381 | body: null |
148 | headers: | 382 | headers: |
149 | Accept: ['*/*'] | 383 | Accept: |
150 | Accept-Encoding: ['gzip, deflate'] | 384 | - '*/*' |
151 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 385 | Accept-Encoding: |
152 | Connection: [keep-alive] | 386 | - gzip, deflate |
153 | Content-Length: ['0'] | 387 | Authorization: |
154 | User-Agent: [python-requests/2.18.4] | 388 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
389 | Connection: | ||
390 | - keep-alive | ||
391 | Content-Length: | ||
392 | - '0' | ||
393 | User-Agent: | ||
394 | - python-requests/2.22.0 | ||
155 | method: DELETE | 395 | method: DELETE |
156 | uri: http://localhost:3000/api/v1/statuses/103704183225122470 | 396 | uri: http://localhost:3000/api/v1/statuses/108532515807337403 |
157 | response: | 397 | response: |
158 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py | 398 | body: |
159 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 399 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py |
400 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
160 | headers: | 401 | headers: |
161 | Cache-Control: ['no-cache, no-store'] | 402 | Cache-Control: |
162 | Content-Type: [application/json; charset=utf-8] | 403 | - no-store |
163 | Referrer-Policy: [strict-origin-when-cross-origin] | 404 | Content-Security-Policy: |
164 | Transfer-Encoding: [chunked] | 405 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
165 | Vary: ['Accept-Encoding, Origin'] | 406 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
166 | X-Content-Type-Options: [nosniff] | 407 | style-src ''self'' http://localhost ''nonce-9ZHC6oHcDEPPkskChbQjOQ==''; media-src |
167 | X-Download-Options: [noopen] | 408 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
168 | X-Frame-Options: [SAMEORIGIN] | 409 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
169 | X-Permitted-Cross-Domain-Policies: [none] | 410 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
170 | X-Request-Id: [c222a2ef-6671-4d1c-97be-0a4e2b2f6a14] | 411 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
171 | X-Runtime: ['0.122283'] | 412 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
172 | X-XSS-Protection: [1; mode=block] | 413 | Content-Type: |
173 | content-length: ['1290'] | 414 | - application/json; charset=utf-8 |
174 | status: {code: 200, message: OK} | 415 | ETag: |
416 | - W/"efc9742f5a2c445d981fd8b15ed77122" | ||
417 | Referrer-Policy: | ||
418 | - strict-origin-when-cross-origin | ||
419 | Transfer-Encoding: | ||
420 | - chunked | ||
421 | Vary: | ||
422 | - Accept, Accept-Encoding, Origin | ||
423 | X-Content-Type-Options: | ||
424 | - nosniff | ||
425 | X-Download-Options: | ||
426 | - noopen | ||
427 | X-Frame-Options: | ||
428 | - SAMEORIGIN | ||
429 | X-Permitted-Cross-Domain-Policies: | ||
430 | - none | ||
431 | X-Request-Id: | ||
432 | - 1ca08d80-70b4-4aa9-abfe-5ca3286f63b8 | ||
433 | X-Runtime: | ||
434 | - '0.037653' | ||
435 | X-XSS-Protection: | ||
436 | - 1; mode=block | ||
437 | content-length: | ||
438 | - '1278' | ||
439 | status: | ||
440 | code: 200 | ||
441 | message: OK | ||
175 | version: 1 | 442 | version: 1 |
diff --git a/tests/cassettes/test_domain_blocks.yaml b/tests/cassettes/test_domain_blocks.yaml index 8889bb1..041541e 100644 --- a/tests/cassettes/test_domain_blocks.yaml +++ b/tests/cassettes/test_domain_blocks.yaml | |||
@@ -10,10 +10,13 @@ interactions: | |||
10 | method: GET | 10 | method: GET |
11 | uri: http://localhost:3000/api/v1/domain_blocks | 11 | uri: http://localhost:3000/api/v1/domain_blocks |
12 | response: | 12 | response: |
13 | body: {string: '[]'} | 13 | body: {string: '["example.com"]'} |
14 | headers: | 14 | headers: |
15 | Cache-Control: ['no-cache, no-store'] | 15 | Cache-Control: ['no-cache, no-store'] |
16 | Content-Type: [application/json; charset=utf-8] | 16 | Content-Type: [application/json; charset=utf-8] |
17 | Link: ['<http://localhost:3000/api/v1/domain_blocks?max_id=10023>; | ||
18 | rel="next", <http://localhost:3000/api/v1/domain_blocks?min_id=10021>; | ||
19 | rel="prev"'] | ||
17 | Referrer-Policy: [strict-origin-when-cross-origin] | 20 | Referrer-Policy: [strict-origin-when-cross-origin] |
18 | Transfer-Encoding: [chunked] | 21 | Transfer-Encoding: [chunked] |
19 | Vary: ['Accept-Encoding, Origin'] | 22 | Vary: ['Accept-Encoding, Origin'] |
@@ -24,6 +27,6 @@ interactions: | |||
24 | X-Request-Id: [79ec8c37-a374-47e4-a698-a8b8511ca20f] | 27 | X-Request-Id: [79ec8c37-a374-47e4-a698-a8b8511ca20f] |
25 | X-Runtime: ['0.098492'] | 28 | X-Runtime: ['0.098492'] |
26 | X-XSS-Protection: [1; mode=block] | 29 | X-XSS-Protection: [1; mode=block] |
27 | content-length: ['2'] | 30 | content-length: ['15'] |
28 | status: {code: 200, message: OK} | 31 | status: {code: 200, message: OK} |
29 | version: 1 | 32 | version: 1 |
diff --git a/tests/cassettes/test_fetch_next_previous_from_pagination_info_oldstyle.yaml b/tests/cassettes/test_fetch_next_previous_from_pagination_info_oldstyle.yaml new file mode 100644 index 0000000..7038e45 --- /dev/null +++ b/tests/cassettes/test_fetch_next_previous_from_pagination_info_oldstyle.yaml | |||
@@ -0,0 +1,749 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: null | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
8 | Connection: [keep-alive] | ||
9 | User-Agent: [python-requests/2.18.4] | ||
10 | method: GET | ||
11 | uri: http://localhost:3000/api/v1/accounts/verify_credentials | ||
12 | response: | ||
13 | body: {string: '{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2020-02-22","source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[]}'} | ||
14 | headers: | ||
15 | Cache-Control: ['no-cache, no-store'] | ||
16 | Content-Type: [application/json; charset=utf-8] | ||
17 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
18 | Transfer-Encoding: [chunked] | ||
19 | Vary: ['Accept-Encoding, Origin'] | ||
20 | X-Content-Type-Options: [nosniff] | ||
21 | X-Download-Options: [noopen] | ||
22 | X-Frame-Options: [SAMEORIGIN] | ||
23 | X-Permitted-Cross-Domain-Policies: [none] | ||
24 | X-Request-Id: [ae32b16c-712a-4109-88b9-392036a21925] | ||
25 | X-Runtime: ['0.651439'] | ||
26 | X-XSS-Protection: [1; mode=block] | ||
27 | content-length: ['745'] | ||
28 | status: {code: 200, message: OK} | ||
29 | - request: | ||
30 | body: status=Toot+number+0%21 | ||
31 | headers: | ||
32 | Accept: ['*/*'] | ||
33 | Accept-Encoding: ['gzip, deflate'] | ||
34 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
35 | Connection: [keep-alive] | ||
36 | Content-Length: ['23'] | ||
37 | Content-Type: [application/x-www-form-urlencoded] | ||
38 | User-Agent: [python-requests/2.18.4] | ||
39 | method: POST | ||
40 | uri: http://localhost:3000/api/v1/statuses | ||
41 | response: | ||
42 | body: {string: '{"id":"103704149189751466","created_at":"2020-02-22T19:28:57.717Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149189751466","url":"http://localhost/@mastodonpy_test/103704149189751466","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
43 | number 0!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
44 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
45 | headers: | ||
46 | Cache-Control: ['no-cache, no-store'] | ||
47 | Content-Type: [application/json; charset=utf-8] | ||
48 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
49 | Transfer-Encoding: [chunked] | ||
50 | Vary: ['Accept-Encoding, Origin'] | ||
51 | X-Content-Type-Options: [nosniff] | ||
52 | X-Download-Options: [noopen] | ||
53 | X-Frame-Options: [SAMEORIGIN] | ||
54 | X-Permitted-Cross-Domain-Policies: [none] | ||
55 | X-Request-Id: [f17c9f1b-ccda-4ffb-8677-931a2bcd778b] | ||
56 | X-Runtime: ['0.801649'] | ||
57 | X-XSS-Protection: [1; mode=block] | ||
58 | content-length: ['1329'] | ||
59 | status: {code: 200, message: OK} | ||
60 | - request: | ||
61 | body: status=Toot+number+1%21 | ||
62 | headers: | ||
63 | Accept: ['*/*'] | ||
64 | Accept-Encoding: ['gzip, deflate'] | ||
65 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
66 | Connection: [keep-alive] | ||
67 | Content-Length: ['23'] | ||
68 | Content-Type: [application/x-www-form-urlencoded] | ||
69 | User-Agent: [python-requests/2.18.4] | ||
70 | method: POST | ||
71 | uri: http://localhost:3000/api/v1/statuses | ||
72 | response: | ||
73 | body: {string: '{"id":"103704149240204204","created_at":"2020-02-22T19:28:58.181Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149240204204","url":"http://localhost/@mastodonpy_test/103704149240204204","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
74 | number 1!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
75 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
76 | headers: | ||
77 | Cache-Control: ['no-cache, no-store'] | ||
78 | Content-Type: [application/json; charset=utf-8] | ||
79 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
80 | Transfer-Encoding: [chunked] | ||
81 | Vary: ['Accept-Encoding, Origin'] | ||
82 | X-Content-Type-Options: [nosniff] | ||
83 | X-Download-Options: [noopen] | ||
84 | X-Frame-Options: [SAMEORIGIN] | ||
85 | X-Permitted-Cross-Domain-Policies: [none] | ||
86 | X-Request-Id: [d3af53b9-a9f0-41ce-b0c4-1a69b7e7f18a] | ||
87 | X-Runtime: ['0.211565'] | ||
88 | X-XSS-Protection: [1; mode=block] | ||
89 | content-length: ['1329'] | ||
90 | status: {code: 200, message: OK} | ||
91 | - request: | ||
92 | body: status=Toot+number+2%21 | ||
93 | headers: | ||
94 | Accept: ['*/*'] | ||
95 | Accept-Encoding: ['gzip, deflate'] | ||
96 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
97 | Connection: [keep-alive] | ||
98 | Content-Length: ['23'] | ||
99 | Content-Type: [application/x-www-form-urlencoded] | ||
100 | User-Agent: [python-requests/2.18.4] | ||
101 | method: POST | ||
102 | uri: http://localhost:3000/api/v1/statuses | ||
103 | response: | ||
104 | body: {string: '{"id":"103704149255716248","created_at":"2020-02-22T19:28:58.413Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149255716248","url":"http://localhost/@mastodonpy_test/103704149255716248","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
105 | number 2!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
106 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
107 | headers: | ||
108 | Cache-Control: ['no-cache, no-store'] | ||
109 | Content-Type: [application/json; charset=utf-8] | ||
110 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
111 | Transfer-Encoding: [chunked] | ||
112 | Vary: ['Accept-Encoding, Origin'] | ||
113 | X-Content-Type-Options: [nosniff] | ||
114 | X-Download-Options: [noopen] | ||
115 | X-Frame-Options: [SAMEORIGIN] | ||
116 | X-Permitted-Cross-Domain-Policies: [none] | ||
117 | X-Request-Id: [dc3327da-8fc5-46c6-8759-8953392d450d] | ||
118 | X-Runtime: ['0.211682'] | ||
119 | X-XSS-Protection: [1; mode=block] | ||
120 | content-length: ['1329'] | ||
121 | status: {code: 200, message: OK} | ||
122 | - request: | ||
123 | body: status=Toot+number+3%21 | ||
124 | headers: | ||
125 | Accept: ['*/*'] | ||
126 | Accept-Encoding: ['gzip, deflate'] | ||
127 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
128 | Connection: [keep-alive] | ||
129 | Content-Length: ['23'] | ||
130 | Content-Type: [application/x-www-form-urlencoded] | ||
131 | User-Agent: [python-requests/2.18.4] | ||
132 | method: POST | ||
133 | uri: http://localhost:3000/api/v1/statuses | ||
134 | response: | ||
135 | body: {string: '{"id":"103704149270849591","created_at":"2020-02-22T19:28:58.643Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149270849591","url":"http://localhost/@mastodonpy_test/103704149270849591","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
136 | number 3!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
137 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
138 | headers: | ||
139 | Cache-Control: ['no-cache, no-store'] | ||
140 | Content-Type: [application/json; charset=utf-8] | ||
141 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
142 | Transfer-Encoding: [chunked] | ||
143 | Vary: ['Accept-Encoding, Origin'] | ||
144 | X-Content-Type-Options: [nosniff] | ||
145 | X-Download-Options: [noopen] | ||
146 | X-Frame-Options: [SAMEORIGIN] | ||
147 | X-Permitted-Cross-Domain-Policies: [none] | ||
148 | X-Request-Id: [3b34502f-358b-4f69-a8a7-b72cee3056a0] | ||
149 | X-Runtime: ['0.205497'] | ||
150 | X-XSS-Protection: [1; mode=block] | ||
151 | content-length: ['1329'] | ||
152 | status: {code: 200, message: OK} | ||
153 | - request: | ||
154 | body: status=Toot+number+4%21 | ||
155 | headers: | ||
156 | Accept: ['*/*'] | ||
157 | Accept-Encoding: ['gzip, deflate'] | ||
158 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
159 | Connection: [keep-alive] | ||
160 | Content-Length: ['23'] | ||
161 | Content-Type: [application/x-www-form-urlencoded] | ||
162 | User-Agent: [python-requests/2.18.4] | ||
163 | method: POST | ||
164 | uri: http://localhost:3000/api/v1/statuses | ||
165 | response: | ||
166 | body: {string: '{"id":"103704149285153724","created_at":"2020-02-22T19:28:58.863Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149285153724","url":"http://localhost/@mastodonpy_test/103704149285153724","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
167 | number 4!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
168 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
169 | headers: | ||
170 | Cache-Control: ['no-cache, no-store'] | ||
171 | Content-Type: [application/json; charset=utf-8] | ||
172 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
173 | Transfer-Encoding: [chunked] | ||
174 | Vary: ['Accept-Encoding, Origin'] | ||
175 | X-Content-Type-Options: [nosniff] | ||
176 | X-Download-Options: [noopen] | ||
177 | X-Frame-Options: [SAMEORIGIN] | ||
178 | X-Permitted-Cross-Domain-Policies: [none] | ||
179 | X-Request-Id: [49cc87eb-ae66-4bbb-8fca-79277c82b4b6] | ||
180 | X-Runtime: ['0.214698'] | ||
181 | X-XSS-Protection: [1; mode=block] | ||
182 | content-length: ['1329'] | ||
183 | status: {code: 200, message: OK} | ||
184 | - request: | ||
185 | body: status=Toot+number+5%21 | ||
186 | headers: | ||
187 | Accept: ['*/*'] | ||
188 | Accept-Encoding: ['gzip, deflate'] | ||
189 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
190 | Connection: [keep-alive] | ||
191 | Content-Length: ['23'] | ||
192 | Content-Type: [application/x-www-form-urlencoded] | ||
193 | User-Agent: [python-requests/2.18.4] | ||
194 | method: POST | ||
195 | uri: http://localhost:3000/api/v1/statuses | ||
196 | response: | ||
197 | body: {string: '{"id":"103704149300069225","created_at":"2020-02-22T19:28:59.095Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149300069225","url":"http://localhost/@mastodonpy_test/103704149300069225","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
198 | number 5!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
199 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":7,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
200 | headers: | ||
201 | Cache-Control: ['no-cache, no-store'] | ||
202 | Content-Type: [application/json; charset=utf-8] | ||
203 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
204 | Transfer-Encoding: [chunked] | ||
205 | Vary: ['Accept-Encoding, Origin'] | ||
206 | X-Content-Type-Options: [nosniff] | ||
207 | X-Download-Options: [noopen] | ||
208 | X-Frame-Options: [SAMEORIGIN] | ||
209 | X-Permitted-Cross-Domain-Policies: [none] | ||
210 | X-Request-Id: [c0aed740-e674-4ca5-8e98-f4cba0044418] | ||
211 | X-Runtime: ['0.225727'] | ||
212 | X-XSS-Protection: [1; mode=block] | ||
213 | content-length: ['1329'] | ||
214 | status: {code: 200, message: OK} | ||
215 | - request: | ||
216 | body: status=Toot+number+6%21 | ||
217 | headers: | ||
218 | Accept: ['*/*'] | ||
219 | Accept-Encoding: ['gzip, deflate'] | ||
220 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
221 | Connection: [keep-alive] | ||
222 | Content-Length: ['23'] | ||
223 | Content-Type: [application/x-www-form-urlencoded] | ||
224 | User-Agent: [python-requests/2.18.4] | ||
225 | method: POST | ||
226 | uri: http://localhost:3000/api/v1/statuses | ||
227 | response: | ||
228 | body: {string: '{"id":"103704149316561035","created_at":"2020-02-22T19:28:59.341Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149316561035","url":"http://localhost/@mastodonpy_test/103704149316561035","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
229 | number 6!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
230 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":8,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
231 | headers: | ||
232 | Cache-Control: ['no-cache, no-store'] | ||
233 | Content-Type: [application/json; charset=utf-8] | ||
234 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
235 | Transfer-Encoding: [chunked] | ||
236 | Vary: ['Accept-Encoding, Origin'] | ||
237 | X-Content-Type-Options: [nosniff] | ||
238 | X-Download-Options: [noopen] | ||
239 | X-Frame-Options: [SAMEORIGIN] | ||
240 | X-Permitted-Cross-Domain-Policies: [none] | ||
241 | X-Request-Id: [93854c13-4b4c-420e-a825-c65efae49785] | ||
242 | X-Runtime: ['0.251071'] | ||
243 | X-XSS-Protection: [1; mode=block] | ||
244 | content-length: ['1329'] | ||
245 | status: {code: 200, message: OK} | ||
246 | - request: | ||
247 | body: status=Toot+number+7%21 | ||
248 | headers: | ||
249 | Accept: ['*/*'] | ||
250 | Accept-Encoding: ['gzip, deflate'] | ||
251 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
252 | Connection: [keep-alive] | ||
253 | Content-Length: ['23'] | ||
254 | Content-Type: [application/x-www-form-urlencoded] | ||
255 | User-Agent: [python-requests/2.18.4] | ||
256 | method: POST | ||
257 | uri: http://localhost:3000/api/v1/statuses | ||
258 | response: | ||
259 | body: {string: '{"id":"103704149334172751","created_at":"2020-02-22T19:28:59.612Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149334172751","url":"http://localhost/@mastodonpy_test/103704149334172751","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
260 | number 7!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
261 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":9,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
262 | headers: | ||
263 | Cache-Control: ['no-cache, no-store'] | ||
264 | Content-Type: [application/json; charset=utf-8] | ||
265 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
266 | Transfer-Encoding: [chunked] | ||
267 | Vary: ['Accept-Encoding, Origin'] | ||
268 | X-Content-Type-Options: [nosniff] | ||
269 | X-Download-Options: [noopen] | ||
270 | X-Frame-Options: [SAMEORIGIN] | ||
271 | X-Permitted-Cross-Domain-Policies: [none] | ||
272 | X-Request-Id: [31c48d09-3509-4a99-ba24-5c08cc689296] | ||
273 | X-Runtime: ['0.203192'] | ||
274 | X-XSS-Protection: [1; mode=block] | ||
275 | content-length: ['1329'] | ||
276 | status: {code: 200, message: OK} | ||
277 | - request: | ||
278 | body: status=Toot+number+8%21 | ||
279 | headers: | ||
280 | Accept: ['*/*'] | ||
281 | Accept-Encoding: ['gzip, deflate'] | ||
282 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
283 | Connection: [keep-alive] | ||
284 | Content-Length: ['23'] | ||
285 | Content-Type: [application/x-www-form-urlencoded] | ||
286 | User-Agent: [python-requests/2.18.4] | ||
287 | method: POST | ||
288 | uri: http://localhost:3000/api/v1/statuses | ||
289 | response: | ||
290 | body: {string: '{"id":"103704149348344165","created_at":"2020-02-22T19:28:59.827Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149348344165","url":"http://localhost/@mastodonpy_test/103704149348344165","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
291 | number 8!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
292 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":10,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
293 | headers: | ||
294 | Cache-Control: ['no-cache, no-store'] | ||
295 | Content-Type: [application/json; charset=utf-8] | ||
296 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
297 | Transfer-Encoding: [chunked] | ||
298 | Vary: ['Accept-Encoding, Origin'] | ||
299 | X-Content-Type-Options: [nosniff] | ||
300 | X-Download-Options: [noopen] | ||
301 | X-Frame-Options: [SAMEORIGIN] | ||
302 | X-Permitted-Cross-Domain-Policies: [none] | ||
303 | X-Request-Id: [24ce9bfd-9f86-4a6a-b889-998c58c137f2] | ||
304 | X-Runtime: ['0.223554'] | ||
305 | X-XSS-Protection: [1; mode=block] | ||
306 | content-length: ['1330'] | ||
307 | status: {code: 200, message: OK} | ||
308 | - request: | ||
309 | body: status=Toot+number+9%21 | ||
310 | headers: | ||
311 | Accept: ['*/*'] | ||
312 | Accept-Encoding: ['gzip, deflate'] | ||
313 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
314 | Connection: [keep-alive] | ||
315 | Content-Length: ['23'] | ||
316 | Content-Type: [application/x-www-form-urlencoded] | ||
317 | User-Agent: [python-requests/2.18.4] | ||
318 | method: POST | ||
319 | uri: http://localhost:3000/api/v1/statuses | ||
320 | response: | ||
321 | body: {string: '{"id":"103704149365440398","created_at":"2020-02-22T19:29:00.089Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149365440398","url":"http://localhost/@mastodonpy_test/103704149365440398","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
322 | number 9!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
323 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
324 | headers: | ||
325 | Cache-Control: ['no-cache, no-store'] | ||
326 | Content-Type: [application/json; charset=utf-8] | ||
327 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
328 | Transfer-Encoding: [chunked] | ||
329 | Vary: ['Accept-Encoding, Origin'] | ||
330 | X-Content-Type-Options: [nosniff] | ||
331 | X-Download-Options: [noopen] | ||
332 | X-Frame-Options: [SAMEORIGIN] | ||
333 | X-Permitted-Cross-Domain-Policies: [none] | ||
334 | X-Request-Id: [98577765-f52d-4994-a792-36c9eef95f62] | ||
335 | X-Runtime: ['0.228954'] | ||
336 | X-XSS-Protection: [1; mode=block] | ||
337 | content-length: ['1330'] | ||
338 | status: {code: 200, message: OK} | ||
339 | - request: | ||
340 | body: null | ||
341 | headers: | ||
342 | Accept: ['*/*'] | ||
343 | Accept-Encoding: ['gzip, deflate'] | ||
344 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
345 | Connection: [keep-alive] | ||
346 | User-Agent: [python-requests/2.18.4] | ||
347 | method: GET | ||
348 | uri: http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5 | ||
349 | response: | ||
350 | body: {string: '[{"id":"103704149365440398","created_at":"2020-02-22T19:29:00.089Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149365440398","url":"http://localhost/@mastodonpy_test/103704149365440398","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
351 | number 9!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
352 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149348344165","created_at":"2020-02-22T19:28:59.827Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149348344165","url":"http://localhost/@mastodonpy_test/103704149348344165","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
353 | number 8!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
354 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149334172751","created_at":"2020-02-22T19:28:59.612Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149334172751","url":"http://localhost/@mastodonpy_test/103704149334172751","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
355 | number 7!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
356 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149316561035","created_at":"2020-02-22T19:28:59.341Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149316561035","url":"http://localhost/@mastodonpy_test/103704149316561035","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
357 | number 6!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
358 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149300069225","created_at":"2020-02-22T19:28:59.095Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149300069225","url":"http://localhost/@mastodonpy_test/103704149300069225","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
359 | number 5!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
360 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} | ||
361 | headers: | ||
362 | Cache-Control: ['no-cache, no-store'] | ||
363 | Content-Type: [application/json; charset=utf-8] | ||
364 | Link: ['<http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&max_id=103704149300069225>; | ||
365 | rel="next", <http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&min_id=103704149365440398>; | ||
366 | rel="prev"'] | ||
367 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
368 | Transfer-Encoding: [chunked] | ||
369 | Vary: ['Accept-Encoding, Origin'] | ||
370 | X-Content-Type-Options: [nosniff] | ||
371 | X-Download-Options: [noopen] | ||
372 | X-Frame-Options: [SAMEORIGIN] | ||
373 | X-Permitted-Cross-Domain-Policies: [none] | ||
374 | X-Request-Id: [4960311a-9e9a-4722-9417-5a34c30c805b] | ||
375 | X-Runtime: ['0.338488'] | ||
376 | X-XSS-Protection: [1; mode=block] | ||
377 | content-length: ['6656'] | ||
378 | status: {code: 200, message: OK} | ||
379 | - request: | ||
380 | body: null | ||
381 | headers: | ||
382 | Accept: ['*/*'] | ||
383 | Accept-Encoding: ['gzip, deflate'] | ||
384 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
385 | Connection: [keep-alive] | ||
386 | User-Agent: [python-requests/2.18.4] | ||
387 | method: GET | ||
388 | uri: http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&max_id=103704149300069225 | ||
389 | response: | ||
390 | body: {string: '[{"id":"103704149285153724","created_at":"2020-02-22T19:28:58.863Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149285153724","url":"http://localhost/@mastodonpy_test/103704149285153724","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
391 | number 4!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
392 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149270849591","created_at":"2020-02-22T19:28:58.643Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149270849591","url":"http://localhost/@mastodonpy_test/103704149270849591","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
393 | number 3!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
394 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149255716248","created_at":"2020-02-22T19:28:58.413Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149255716248","url":"http://localhost/@mastodonpy_test/103704149255716248","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
395 | number 2!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
396 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149240204204","created_at":"2020-02-22T19:28:58.181Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149240204204","url":"http://localhost/@mastodonpy_test/103704149240204204","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
397 | number 1!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
398 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149189751466","created_at":"2020-02-22T19:28:57.717Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149189751466","url":"http://localhost/@mastodonpy_test/103704149189751466","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
399 | number 0!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
400 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} | ||
401 | headers: | ||
402 | Cache-Control: ['no-cache, no-store'] | ||
403 | Content-Type: [application/json; charset=utf-8] | ||
404 | Link: ['<http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&max_id=103704149189751466>; | ||
405 | rel="next", <http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&min_id=103704149285153724>; | ||
406 | rel="prev"'] | ||
407 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
408 | Transfer-Encoding: [chunked] | ||
409 | Vary: ['Accept-Encoding, Origin'] | ||
410 | X-Content-Type-Options: [nosniff] | ||
411 | X-Download-Options: [noopen] | ||
412 | X-Frame-Options: [SAMEORIGIN] | ||
413 | X-Permitted-Cross-Domain-Policies: [none] | ||
414 | X-Request-Id: [aa025632-b316-43c0-afc5-243f62d2b6b8] | ||
415 | X-Runtime: ['0.201975'] | ||
416 | X-XSS-Protection: [1; mode=block] | ||
417 | content-length: ['6656'] | ||
418 | status: {code: 200, message: OK} | ||
419 | - request: | ||
420 | body: null | ||
421 | headers: | ||
422 | Accept: ['*/*'] | ||
423 | Accept-Encoding: ['gzip, deflate'] | ||
424 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
425 | Connection: [keep-alive] | ||
426 | User-Agent: [python-requests/2.18.4] | ||
427 | method: GET | ||
428 | uri: http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&min_id=103704149285153724 | ||
429 | response: | ||
430 | body: {string: '[{"id":"103704149365440398","created_at":"2020-02-22T19:29:00.089Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149365440398","url":"http://localhost/@mastodonpy_test/103704149365440398","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
431 | number 9!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
432 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149348344165","created_at":"2020-02-22T19:28:59.827Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149348344165","url":"http://localhost/@mastodonpy_test/103704149348344165","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
433 | number 8!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
434 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149334172751","created_at":"2020-02-22T19:28:59.612Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149334172751","url":"http://localhost/@mastodonpy_test/103704149334172751","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
435 | number 7!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
436 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149316561035","created_at":"2020-02-22T19:28:59.341Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149316561035","url":"http://localhost/@mastodonpy_test/103704149316561035","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
437 | number 6!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
438 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},{"id":"103704149300069225","created_at":"2020-02-22T19:28:59.095Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149300069225","url":"http://localhost/@mastodonpy_test/103704149300069225","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot | ||
439 | number 5!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
440 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} | ||
441 | headers: | ||
442 | Cache-Control: ['no-cache, no-store'] | ||
443 | Content-Type: [application/json; charset=utf-8] | ||
444 | Link: ['<http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&max_id=103704149300069225>; | ||
445 | rel="next", <http://localhost:3000/api/v1/accounts/1234567890123456/statuses?limit=5&min_id=103704149365440398>; | ||
446 | rel="prev"'] | ||
447 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
448 | Transfer-Encoding: [chunked] | ||
449 | Vary: ['Accept-Encoding, Origin'] | ||
450 | X-Content-Type-Options: [nosniff] | ||
451 | X-Download-Options: [noopen] | ||
452 | X-Frame-Options: [SAMEORIGIN] | ||
453 | X-Permitted-Cross-Domain-Policies: [none] | ||
454 | X-Request-Id: [03a7b3a0-09b2-4281-833e-d5885806890e] | ||
455 | X-Runtime: ['0.169965'] | ||
456 | X-XSS-Protection: [1; mode=block] | ||
457 | content-length: ['6656'] | ||
458 | status: {code: 200, message: OK} | ||
459 | - request: | ||
460 | body: null | ||
461 | headers: | ||
462 | Accept: ['*/*'] | ||
463 | Accept-Encoding: ['gzip, deflate'] | ||
464 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
465 | Connection: [keep-alive] | ||
466 | Content-Length: ['0'] | ||
467 | User-Agent: [python-requests/2.18.4] | ||
468 | method: DELETE | ||
469 | uri: http://localhost:3000/api/v1/statuses/103704149189751466 | ||
470 | response: | ||
471 | body: {string: '{"id":"103704149189751466","created_at":"2020-02-22T19:28:57.717Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149189751466","url":"http://localhost/@mastodonpy_test/103704149189751466","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
472 | number 0!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":11,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
473 | headers: | ||
474 | Cache-Control: ['no-cache, no-store'] | ||
475 | Content-Type: [application/json; charset=utf-8] | ||
476 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
477 | Transfer-Encoding: [chunked] | ||
478 | Vary: ['Accept-Encoding, Origin'] | ||
479 | X-Content-Type-Options: [nosniff] | ||
480 | X-Download-Options: [noopen] | ||
481 | X-Frame-Options: [SAMEORIGIN] | ||
482 | X-Permitted-Cross-Domain-Policies: [none] | ||
483 | X-Request-Id: [c9121201-0be7-4c73-bdce-884e21d969d4] | ||
484 | X-Runtime: ['0.157991'] | ||
485 | X-XSS-Protection: [1; mode=block] | ||
486 | content-length: ['1300'] | ||
487 | status: {code: 200, message: OK} | ||
488 | - request: | ||
489 | body: null | ||
490 | headers: | ||
491 | Accept: ['*/*'] | ||
492 | Accept-Encoding: ['gzip, deflate'] | ||
493 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
494 | Connection: [keep-alive] | ||
495 | Content-Length: ['0'] | ||
496 | User-Agent: [python-requests/2.18.4] | ||
497 | method: DELETE | ||
498 | uri: http://localhost:3000/api/v1/statuses/103704149240204204 | ||
499 | response: | ||
500 | body: {string: '{"id":"103704149240204204","created_at":"2020-02-22T19:28:58.181Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149240204204","url":"http://localhost/@mastodonpy_test/103704149240204204","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
501 | number 1!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":10,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
502 | headers: | ||
503 | Cache-Control: ['no-cache, no-store'] | ||
504 | Content-Type: [application/json; charset=utf-8] | ||
505 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
506 | Transfer-Encoding: [chunked] | ||
507 | Vary: ['Accept-Encoding, Origin'] | ||
508 | X-Content-Type-Options: [nosniff] | ||
509 | X-Download-Options: [noopen] | ||
510 | X-Frame-Options: [SAMEORIGIN] | ||
511 | X-Permitted-Cross-Domain-Policies: [none] | ||
512 | X-Request-Id: [e2df2022-af35-41e7-ab48-c888b17fb266] | ||
513 | X-Runtime: ['0.205063'] | ||
514 | X-XSS-Protection: [1; mode=block] | ||
515 | content-length: ['1300'] | ||
516 | status: {code: 200, message: OK} | ||
517 | - request: | ||
518 | body: null | ||
519 | headers: | ||
520 | Accept: ['*/*'] | ||
521 | Accept-Encoding: ['gzip, deflate'] | ||
522 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
523 | Connection: [keep-alive] | ||
524 | Content-Length: ['0'] | ||
525 | User-Agent: [python-requests/2.18.4] | ||
526 | method: DELETE | ||
527 | uri: http://localhost:3000/api/v1/statuses/103704149255716248 | ||
528 | response: | ||
529 | body: {string: '{"id":"103704149255716248","created_at":"2020-02-22T19:28:58.413Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149255716248","url":"http://localhost/@mastodonpy_test/103704149255716248","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
530 | number 2!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":9,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
531 | headers: | ||
532 | Cache-Control: ['no-cache, no-store'] | ||
533 | Content-Type: [application/json; charset=utf-8] | ||
534 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
535 | Transfer-Encoding: [chunked] | ||
536 | Vary: ['Accept-Encoding, Origin'] | ||
537 | X-Content-Type-Options: [nosniff] | ||
538 | X-Download-Options: [noopen] | ||
539 | X-Frame-Options: [SAMEORIGIN] | ||
540 | X-Permitted-Cross-Domain-Policies: [none] | ||
541 | X-Request-Id: [cd3f1791-e612-445c-853a-d1b49229fdc7] | ||
542 | X-Runtime: ['0.173011'] | ||
543 | X-XSS-Protection: [1; mode=block] | ||
544 | content-length: ['1299'] | ||
545 | status: {code: 200, message: OK} | ||
546 | - request: | ||
547 | body: null | ||
548 | headers: | ||
549 | Accept: ['*/*'] | ||
550 | Accept-Encoding: ['gzip, deflate'] | ||
551 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
552 | Connection: [keep-alive] | ||
553 | Content-Length: ['0'] | ||
554 | User-Agent: [python-requests/2.18.4] | ||
555 | method: DELETE | ||
556 | uri: http://localhost:3000/api/v1/statuses/103704149270849591 | ||
557 | response: | ||
558 | body: {string: '{"id":"103704149270849591","created_at":"2020-02-22T19:28:58.643Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149270849591","url":"http://localhost/@mastodonpy_test/103704149270849591","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
559 | number 3!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":8,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
560 | headers: | ||
561 | Cache-Control: ['no-cache, no-store'] | ||
562 | Content-Type: [application/json; charset=utf-8] | ||
563 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
564 | Transfer-Encoding: [chunked] | ||
565 | Vary: ['Accept-Encoding, Origin'] | ||
566 | X-Content-Type-Options: [nosniff] | ||
567 | X-Download-Options: [noopen] | ||
568 | X-Frame-Options: [SAMEORIGIN] | ||
569 | X-Permitted-Cross-Domain-Policies: [none] | ||
570 | X-Request-Id: [86e29869-c84c-4bda-ba30-cf3b7c047351] | ||
571 | X-Runtime: ['0.162408'] | ||
572 | X-XSS-Protection: [1; mode=block] | ||
573 | content-length: ['1299'] | ||
574 | status: {code: 200, message: OK} | ||
575 | - request: | ||
576 | body: null | ||
577 | headers: | ||
578 | Accept: ['*/*'] | ||
579 | Accept-Encoding: ['gzip, deflate'] | ||
580 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
581 | Connection: [keep-alive] | ||
582 | Content-Length: ['0'] | ||
583 | User-Agent: [python-requests/2.18.4] | ||
584 | method: DELETE | ||
585 | uri: http://localhost:3000/api/v1/statuses/103704149285153724 | ||
586 | response: | ||
587 | body: {string: '{"id":"103704149285153724","created_at":"2020-02-22T19:28:58.863Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149285153724","url":"http://localhost/@mastodonpy_test/103704149285153724","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
588 | number 4!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":7,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
589 | headers: | ||
590 | Cache-Control: ['no-cache, no-store'] | ||
591 | Content-Type: [application/json; charset=utf-8] | ||
592 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
593 | Transfer-Encoding: [chunked] | ||
594 | Vary: ['Accept-Encoding, Origin'] | ||
595 | X-Content-Type-Options: [nosniff] | ||
596 | X-Download-Options: [noopen] | ||
597 | X-Frame-Options: [SAMEORIGIN] | ||
598 | X-Permitted-Cross-Domain-Policies: [none] | ||
599 | X-Request-Id: [4c6c6433-9a62-4b28-ad17-98c12279e9da] | ||
600 | X-Runtime: ['0.126905'] | ||
601 | X-XSS-Protection: [1; mode=block] | ||
602 | content-length: ['1299'] | ||
603 | status: {code: 200, message: OK} | ||
604 | - request: | ||
605 | body: null | ||
606 | headers: | ||
607 | Accept: ['*/*'] | ||
608 | Accept-Encoding: ['gzip, deflate'] | ||
609 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
610 | Connection: [keep-alive] | ||
611 | Content-Length: ['0'] | ||
612 | User-Agent: [python-requests/2.18.4] | ||
613 | method: DELETE | ||
614 | uri: http://localhost:3000/api/v1/statuses/103704149300069225 | ||
615 | response: | ||
616 | body: {string: '{"id":"103704149300069225","created_at":"2020-02-22T19:28:59.095Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149300069225","url":"http://localhost/@mastodonpy_test/103704149300069225","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
617 | number 5!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
618 | headers: | ||
619 | Cache-Control: ['no-cache, no-store'] | ||
620 | Content-Type: [application/json; charset=utf-8] | ||
621 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
622 | Transfer-Encoding: [chunked] | ||
623 | Vary: ['Accept-Encoding, Origin'] | ||
624 | X-Content-Type-Options: [nosniff] | ||
625 | X-Download-Options: [noopen] | ||
626 | X-Frame-Options: [SAMEORIGIN] | ||
627 | X-Permitted-Cross-Domain-Policies: [none] | ||
628 | X-Request-Id: [a4a8ad1a-7b70-4322-b524-34c7a6966505] | ||
629 | X-Runtime: ['0.130927'] | ||
630 | X-XSS-Protection: [1; mode=block] | ||
631 | content-length: ['1299'] | ||
632 | status: {code: 200, message: OK} | ||
633 | - request: | ||
634 | body: null | ||
635 | headers: | ||
636 | Accept: ['*/*'] | ||
637 | Accept-Encoding: ['gzip, deflate'] | ||
638 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
639 | Connection: [keep-alive] | ||
640 | Content-Length: ['0'] | ||
641 | User-Agent: [python-requests/2.18.4] | ||
642 | method: DELETE | ||
643 | uri: http://localhost:3000/api/v1/statuses/103704149316561035 | ||
644 | response: | ||
645 | body: {string: '{"id":"103704149316561035","created_at":"2020-02-22T19:28:59.341Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149316561035","url":"http://localhost/@mastodonpy_test/103704149316561035","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
646 | number 6!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
647 | headers: | ||
648 | Cache-Control: ['no-cache, no-store'] | ||
649 | Content-Type: [application/json; charset=utf-8] | ||
650 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
651 | Transfer-Encoding: [chunked] | ||
652 | Vary: ['Accept-Encoding, Origin'] | ||
653 | X-Content-Type-Options: [nosniff] | ||
654 | X-Download-Options: [noopen] | ||
655 | X-Frame-Options: [SAMEORIGIN] | ||
656 | X-Permitted-Cross-Domain-Policies: [none] | ||
657 | X-Request-Id: [2a19b9cb-7487-4c3f-9b5a-f8796526945b] | ||
658 | X-Runtime: ['0.137676'] | ||
659 | X-XSS-Protection: [1; mode=block] | ||
660 | content-length: ['1299'] | ||
661 | status: {code: 200, message: OK} | ||
662 | - request: | ||
663 | body: null | ||
664 | headers: | ||
665 | Accept: ['*/*'] | ||
666 | Accept-Encoding: ['gzip, deflate'] | ||
667 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
668 | Connection: [keep-alive] | ||
669 | Content-Length: ['0'] | ||
670 | User-Agent: [python-requests/2.18.4] | ||
671 | method: DELETE | ||
672 | uri: http://localhost:3000/api/v1/statuses/103704149334172751 | ||
673 | response: | ||
674 | body: {string: '{"id":"103704149334172751","created_at":"2020-02-22T19:28:59.612Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149334172751","url":"http://localhost/@mastodonpy_test/103704149334172751","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
675 | number 7!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
676 | headers: | ||
677 | Cache-Control: ['no-cache, no-store'] | ||
678 | Content-Type: [application/json; charset=utf-8] | ||
679 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
680 | Transfer-Encoding: [chunked] | ||
681 | Vary: ['Accept-Encoding, Origin'] | ||
682 | X-Content-Type-Options: [nosniff] | ||
683 | X-Download-Options: [noopen] | ||
684 | X-Frame-Options: [SAMEORIGIN] | ||
685 | X-Permitted-Cross-Domain-Policies: [none] | ||
686 | X-Request-Id: [7a8d07ec-da26-4554-8011-46a70cf4c356] | ||
687 | X-Runtime: ['0.138911'] | ||
688 | X-XSS-Protection: [1; mode=block] | ||
689 | content-length: ['1299'] | ||
690 | status: {code: 200, message: OK} | ||
691 | - request: | ||
692 | body: null | ||
693 | headers: | ||
694 | Accept: ['*/*'] | ||
695 | Accept-Encoding: ['gzip, deflate'] | ||
696 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
697 | Connection: [keep-alive] | ||
698 | Content-Length: ['0'] | ||
699 | User-Agent: [python-requests/2.18.4] | ||
700 | method: DELETE | ||
701 | uri: http://localhost:3000/api/v1/statuses/103704149348344165 | ||
702 | response: | ||
703 | body: {string: '{"id":"103704149348344165","created_at":"2020-02-22T19:28:59.827Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149348344165","url":"http://localhost/@mastodonpy_test/103704149348344165","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
704 | number 8!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
705 | headers: | ||
706 | Cache-Control: ['no-cache, no-store'] | ||
707 | Content-Type: [application/json; charset=utf-8] | ||
708 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
709 | Transfer-Encoding: [chunked] | ||
710 | Vary: ['Accept-Encoding, Origin'] | ||
711 | X-Content-Type-Options: [nosniff] | ||
712 | X-Download-Options: [noopen] | ||
713 | X-Frame-Options: [SAMEORIGIN] | ||
714 | X-Permitted-Cross-Domain-Policies: [none] | ||
715 | X-Request-Id: [4cdbde9e-b14a-405e-840e-d5ebac69f1a6] | ||
716 | X-Runtime: ['0.143361'] | ||
717 | X-XSS-Protection: [1; mode=block] | ||
718 | content-length: ['1299'] | ||
719 | status: {code: 200, message: OK} | ||
720 | - request: | ||
721 | body: null | ||
722 | headers: | ||
723 | Accept: ['*/*'] | ||
724 | Accept-Encoding: ['gzip, deflate'] | ||
725 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
726 | Connection: [keep-alive] | ||
727 | Content-Length: ['0'] | ||
728 | User-Agent: [python-requests/2.18.4] | ||
729 | method: DELETE | ||
730 | uri: http://localhost:3000/api/v1/statuses/103704149365440398 | ||
731 | response: | ||
732 | body: {string: '{"id":"103704149365440398","created_at":"2020-02-22T19:29:00.089Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704149365440398","url":"http://localhost/@mastodonpy_test/103704149365440398","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot | ||
733 | number 9!","reblog":null,"application":{"name":"Mastodon.py test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
734 | headers: | ||
735 | Cache-Control: ['no-cache, no-store'] | ||
736 | Content-Type: [application/json; charset=utf-8] | ||
737 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
738 | Transfer-Encoding: [chunked] | ||
739 | Vary: ['Accept-Encoding, Origin'] | ||
740 | X-Content-Type-Options: [nosniff] | ||
741 | X-Download-Options: [noopen] | ||
742 | X-Frame-Options: [SAMEORIGIN] | ||
743 | X-Permitted-Cross-Domain-Policies: [none] | ||
744 | X-Request-Id: [41b9b30e-23fa-4929-a1a2-417ae0d28b48] | ||
745 | X-Runtime: ['0.130683'] | ||
746 | X-XSS-Protection: [1; mode=block] | ||
747 | content-length: ['1299'] | ||
748 | status: {code: 200, message: OK} | ||
749 | version: 1 | ||
diff --git a/tests/conftest.py b/tests/conftest.py index 22a4b75..8e64919 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
@@ -8,7 +8,8 @@ def _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN', version="3.1.1", versio | |||
8 | client_secret='__MASTODON_PY_TEST_CLIENT_SECRET', | 8 | client_secret='__MASTODON_PY_TEST_CLIENT_SECRET', |
9 | access_token=access_token, | 9 | access_token=access_token, |
10 | mastodon_version=version, | 10 | mastodon_version=version, |
11 | version_check_mode=version_check_mode) | 11 | version_check_mode=version_check_mode, |
12 | user_agent='tests/v311') | ||
12 | 13 | ||
13 | 14 | ||
14 | @pytest.fixture | 15 | @pytest.fixture |
diff --git a/tests/test_bookmarks.py b/tests/test_bookmarks.py index a90a43e..e5e0d7c 100644 --- a/tests/test_bookmarks.py +++ b/tests/test_bookmarks.py | |||
@@ -11,6 +11,11 @@ def test_bookmarks(api, status): | |||
11 | assert len(bookmarked_statuses) > 0 | 11 | assert len(bookmarked_statuses) > 0 |
12 | assert status_bookmarked == bookmarked_statuses[0] | 12 | assert status_bookmarked == bookmarked_statuses[0] |
13 | 13 | ||
14 | bookmarked_statuses = api.bookmarks(limit=1) | ||
15 | assert bookmarked_statuses | ||
16 | assert len(bookmarked_statuses) > 0 | ||
17 | assert status_bookmarked == bookmarked_statuses[0] | ||
18 | |||
14 | status_unbookmarked = api.status_unbookmark(status_bookmarked) | 19 | status_unbookmarked = api.status_unbookmark(status_bookmarked) |
15 | assert status_unbookmarked | 20 | assert status_unbookmarked |
16 | assert status_unbookmarked.bookmarked == False | 21 | assert status_unbookmarked.bookmarked == False |
diff --git a/tests/test_create_app.py b/tests/test_create_app.py index 8260751..08538ce 100644 --- a/tests/test_create_app.py +++ b/tests/test_create_app.py | |||
@@ -31,7 +31,7 @@ def test_create_app(mocker, to_file=None, redirect_uris=None, website=None): | |||
31 | def test_create_app_to_file(mocker, tmpdir): | 31 | def test_create_app_to_file(mocker, tmpdir): |
32 | filepath = tmpdir.join('credentials') | 32 | filepath = tmpdir.join('credentials') |
33 | test_create_app(mocker, to_file=str(filepath)) | 33 | test_create_app(mocker, to_file=str(filepath)) |
34 | assert filepath.read_text('UTF-8') == "foo\nbar\nhttps://example.com\n" | 34 | assert filepath.read_text('UTF-8') == "foo\nbar\nhttps://example.com\nMastodon.py test suite\n" |
35 | 35 | ||
36 | def test_create_app_redirect_uris(mocker): | 36 | def test_create_app_redirect_uris(mocker): |
37 | test_create_app(mocker, redirect_uris='http://example.net') | 37 | test_create_app(mocker, redirect_uris='http://example.net') |
diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 72ac06e..9f26140 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py | |||
@@ -39,6 +39,17 @@ def test_fetch_next_previous_from_pagination_info(api): | |||
39 | account = api.account_verify_credentials() | 39 | account = api.account_verify_credentials() |
40 | with many_statuses(api): | 40 | with many_statuses(api): |
41 | statuses = api.account_statuses(account['id'], limit=5) | 41 | statuses = api.account_statuses(account['id'], limit=5) |
42 | next_statuses = api.fetch_next(statuses._pagination_next) | ||
43 | assert next_statuses | ||
44 | previous_statuses = api.fetch_previous(next_statuses._pagination_prev) | ||
45 | assert previous_statuses | ||
46 | |||
47 | @pytest.mark.vcr() | ||
48 | def test_fetch_next_previous_from_pagination_info_oldstyle(api): | ||
49 | # Old style compatibility mode. The storage in the list items is not anymore internally used. | ||
50 | account = api.account_verify_credentials() | ||
51 | with many_statuses(api): | ||
52 | statuses = api.account_statuses(account['id'], limit=5) | ||
42 | next_statuses = api.fetch_next(statuses[-1]._pagination_next) | 53 | next_statuses = api.fetch_next(statuses[-1]._pagination_next) |
43 | assert next_statuses | 54 | assert next_statuses |
44 | previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) | 55 | previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) |
@@ -61,6 +72,17 @@ def test_fetch_next_previous_from_pagination_info_old_pagination(api): | |||
61 | 72 | ||
62 | with many_statuses(api): | 73 | with many_statuses(api): |
63 | statuses = api.account_statuses(account['id'], limit=5) | 74 | statuses = api.account_statuses(account['id'], limit=5) |
75 | next_statuses = api.fetch_next(statuses._pagination_next) | ||
76 | assert next_statuses | ||
77 | previous_statuses = api.fetch_previous(next_statuses._pagination_prev) | ||
78 | assert previous_statuses | ||
79 | |||
80 | # Old style compatibility mode. The storage in the list items is not anymore internally used. | ||
81 | with vcr.use_cassette('test_fetch_next_previous_from_pagination_info.yaml', cassette_library_dir='tests/cassettes_old_pagination', record_mode='none'): | ||
82 | account = api.account_verify_credentials() | ||
83 | |||
84 | with many_statuses(api): | ||
85 | statuses = api.account_statuses(account['id'], limit=5) | ||
64 | next_statuses = api.fetch_next(statuses[-1]._pagination_next) | 86 | next_statuses = api.fetch_next(statuses[-1]._pagination_next) |
65 | assert next_statuses | 87 | assert next_statuses |
66 | previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) | 88 | previous_statuses = api.fetch_previous(next_statuses[0]._pagination_prev) |
@@ -86,5 +108,9 @@ def test_link_headers(api): | |||
86 | }) | 108 | }) |
87 | 109 | ||
88 | resp = api.timeline_hashtag(UNLIKELY_HASHTAG) | 110 | resp = api.timeline_hashtag(UNLIKELY_HASHTAG) |
111 | assert resp._pagination_next['max_id'] == _id | ||
112 | assert resp._pagination_prev['since_id'] == _id | ||
113 | |||
114 | # Old style compatibility mode. The storage in the list items is not anymore internally used. | ||
89 | assert resp[0]._pagination_next['max_id'] == _id | 115 | assert resp[0]._pagination_next['max_id'] == _id |
90 | assert resp[0]._pagination_prev['since_id'] == _id | 116 | assert resp[0]._pagination_prev['since_id'] == _id \ No newline at end of file |
diff --git a/tests/test_streaming.py b/tests/test_streaming.py index cddb79a..8912b9c 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py | |||
@@ -61,6 +61,8 @@ class Listener(StreamListener): | |||
61 | self.notifications = [] | 61 | self.notifications = [] |
62 | self.deletes = [] | 62 | self.deletes = [] |
63 | self.heartbeats = 0 | 63 | self.heartbeats = 0 |
64 | self.bla_called = False | ||
65 | self.do_something_called = False | ||
64 | 66 | ||
65 | def on_update(self, status): | 67 | def on_update(self, status): |
66 | self.updates.append(status) | 68 | self.updates.append(status) |
@@ -72,6 +74,11 @@ class Listener(StreamListener): | |||
72 | self.deletes.append(status_id) | 74 | self.deletes.append(status_id) |
73 | 75 | ||
74 | def on_blahblah(self, data): | 76 | def on_blahblah(self, data): |
77 | self.bla_called = True | ||
78 | pass | ||
79 | |||
80 | def on_do_something(self, data): | ||
81 | self.do_something_called = True | ||
75 | pass | 82 | pass |
76 | 83 | ||
77 | def handle_heartbeat(self): | 84 | def handle_heartbeat(self): |
@@ -158,6 +165,37 @@ def test_unknown_event(): | |||
158 | 'data: {}', | 165 | 'data: {}', |
159 | '', | 166 | '', |
160 | ]) | 167 | ]) |
168 | assert listener.bla_called == True | ||
169 | assert listener.updates == [] | ||
170 | assert listener.notifications == [] | ||
171 | assert listener.deletes == [] | ||
172 | assert listener.heartbeats == 0 | ||
173 | |||
174 | def test_unknown_handled_event(): | ||
175 | """Be tolerant of new unknown event types, if on_unknown_event is available""" | ||
176 | listener = Listener() | ||
177 | listener.on_unknown_event = lambda name, payload: None | ||
178 | |||
179 | listener.handle_stream_([ | ||
180 | 'event: complete.new.event', | ||
181 | 'data: {"k": "v"}', | ||
182 | '', | ||
183 | ]) | ||
184 | |||
185 | assert listener.updates == [] | ||
186 | assert listener.notifications == [] | ||
187 | assert listener.deletes == [] | ||
188 | assert listener.heartbeats == 0 | ||
189 | |||
190 | def test_dotted_unknown_event(): | ||
191 | """Be tolerant of new event types with dots in the event-name""" | ||
192 | listener = Listener() | ||
193 | listener.handle_stream_([ | ||
194 | 'event: do.something', | ||
195 | 'data: {}', | ||
196 | '', | ||
197 | ]) | ||
198 | assert listener.do_something_called == True | ||
161 | assert listener.updates == [] | 199 | assert listener.updates == [] |
162 | assert listener.notifications == [] | 200 | assert listener.notifications == [] |
163 | assert listener.deletes == [] | 201 | assert listener.deletes == [] |
@@ -169,7 +207,7 @@ def test_invalid_event(): | |||
169 | with pytest.raises(MastodonMalformedEventError): | 207 | with pytest.raises(MastodonMalformedEventError): |
170 | listener.handle_stream_([ | 208 | listener.handle_stream_([ |
171 | 'event: whatup', | 209 | 'event: whatup', |
172 | 'data: {}', | 210 | 'data: {"k": "v"}', |
173 | '', | 211 | '', |
174 | ]) | 212 | ]) |
175 | 213 | ||