Add healthy test cassette
This commit is contained in:
pare
71c6bc0f52
commit
a88492bdcf
S'han modificat 4 arxius amb 70 adicions i 9 eliminacions
|
@ -4,6 +4,8 @@ version number. Breaking changes will be indicated by a change in the minor
|
|||
|
||||
v1.4.4
|
||||
------
|
||||
* Made status_delete return the deleted status (With "source" attribute)
|
||||
* Added account_id parameter to notifications
|
||||
* Added streaming_health
|
||||
* Added support for local hashtag streams
|
||||
* Made blurhash an optional dependency (Thanks limburgher)
|
||||
|
|
|
@ -543,7 +543,7 @@ Media dicts
|
|||
# Returns the following dictionary:
|
||||
{
|
||||
'id': # The ID of the attachment.
|
||||
'type': # Media type: 'image', 'video', 'gifv' or 'unknown'.
|
||||
'type': # Media type: 'image', 'video', 'gifv', 'audio' or 'unknown'.
|
||||
'url': # The URL for the image in the local cache
|
||||
'remote_url': # The remote URL for the media (if the image is from a remote instance)
|
||||
'preview_url': # The URL for the media preview
|
||||
|
|
|
@ -179,7 +179,7 @@ class Mastodon:
|
|||
__DICT_VERSION_MEDIA = "2.8.2"
|
||||
__DICT_VERSION_ACCOUNT = "2.4.0"
|
||||
__DICT_VERSION_POLL = "2.8.0"
|
||||
__DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.8.0",
|
||||
__DICT_VERSION_STATUS = bigger_version(bigger_version(bigger_version(bigger_version(bigger_version("2.9.1",
|
||||
__DICT_VERSION_MEDIA), __DICT_VERSION_ACCOUNT), __DICT_VERSION_APPLICATION), __DICT_VERSION_MENTION), __DICT_VERSION_POLL)
|
||||
__DICT_VERSION_INSTANCE = bigger_version("2.7.2", __DICT_VERSION_ACCOUNT)
|
||||
__DICT_VERSION_HASHTAG = "2.3.4"
|
||||
|
@ -865,11 +865,11 @@ class Mastodon:
|
|||
###
|
||||
# Reading data: Notifications
|
||||
###
|
||||
@api_version("1.0.0", "2.6.0", __DICT_VERSION_NOTIFICATION)
|
||||
def notifications(self, id=None, max_id=None, min_id=None, since_id=None, limit=None):
|
||||
@api_version("1.0.0", "2.9.0", __DICT_VERSION_NOTIFICATION)
|
||||
def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None):
|
||||
"""
|
||||
Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in
|
||||
user.
|
||||
user. Pass `account_id` to get only notifications originating from the given account.
|
||||
|
||||
Can be passed an `id` to fetch a single notification.
|
||||
|
||||
|
@ -884,6 +884,9 @@ class Mastodon:
|
|||
if since_id != None:
|
||||
since_id = self.__unpack_id(since_id)
|
||||
|
||||
if account_id != None:
|
||||
account_id = self.__unpack_id(account_id)
|
||||
|
||||
if id is None:
|
||||
params = self.__generate_params(locals(), ['id'])
|
||||
return self.__api_request('GET', '/api/v1/notifications', params)
|
||||
|
@ -1606,10 +1609,14 @@ class Mastodon:
|
|||
def status_delete(self, id):
|
||||
"""
|
||||
Delete a status
|
||||
|
||||
Returns the now-deleted status, with an added "source" attribute that contains
|
||||
the text that was used to compose this status (this can be used to power
|
||||
"delete and redraft" functionality)
|
||||
"""
|
||||
id = self.__unpack_id(id)
|
||||
url = '/api/v1/statuses/{0}'.format(str(id))
|
||||
self.__api_request('DELETE', url)
|
||||
return self.__api_request('DELETE', url)
|
||||
|
||||
@api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS)
|
||||
def status_reblog(self, id, visibility=None):
|
||||
|
@ -2159,10 +2166,10 @@ class Mastodon:
|
|||
###
|
||||
# Writing data: Media
|
||||
###
|
||||
@api_version("1.0.0", "2.3.0", __DICT_VERSION_MEDIA)
|
||||
@api_version("1.0.0", "2.9.1", __DICT_VERSION_MEDIA)
|
||||
def media_post(self, media_file, mime_type=None, description=None, focus=None):
|
||||
"""
|
||||
Post an image. `media_file` can either be image data or
|
||||
Post an image, video or audio file. `media_file` can either be image data or
|
||||
a file name. If image data is passed directly, the mime
|
||||
type has to be specified manually, otherwise, it is
|
||||
determined from the file name. `focus` should be a tuple
|
||||
|
|
52
tests/cassettes/test_stream_healthy.yaml
Normal file
52
tests/cassettes/test_stream_healthy.yaml
Normal file
|
@ -0,0 +1,52 @@
|
|||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept: ['*/*']
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Connection: [keep-alive]
|
||||
User-Agent: [python-requests/2.18.4]
|
||||
method: GET
|
||||
uri: http://localhost:3000/api/v1/instance/
|
||||
response:
|
||||
body: {string: '{"uri":"localhost","title":"Mastodon","description":"","email":"","version":"2.9.1","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":2,"status_count":8,"domain_count":0},"thumbnail":"http://localhost/packs/media/images/preview-9a17d32fc48369e8ccd910a75260e67d.jpg","languages":["en"],"registrations":true,"contact_account":null}'}
|
||||
headers:
|
||||
Cache-Control: ['max-age=300, public']
|
||||
Content-Type: [application/json; charset=utf-8]
|
||||
Date: ['Sat, 22 Jun 2019 14:40:35 GMT']
|
||||
ETag: [W/"9cf634ec19499004934b5325f20d71b4"]
|
||||
Referrer-Policy: [strict-origin-when-cross-origin]
|
||||
Transfer-Encoding: [chunked]
|
||||
Vary: ['Accept-Encoding, Origin']
|
||||
X-Content-Type-Options: [nosniff]
|
||||
X-Download-Options: [noopen]
|
||||
X-Frame-Options: [SAMEORIGIN]
|
||||
X-Permitted-Cross-Domain-Policies: [none]
|
||||
X-Request-Id: [e205dad6-1b7d-4469-82e6-b1928be37b2f]
|
||||
X-Runtime: ['0.026031']
|
||||
X-XSS-Protection: [1; mode=block]
|
||||
content-length: ['348']
|
||||
status: {code: 200, message: OK}
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept: ['*/*']
|
||||
Accept-Encoding: ['gzip, deflate']
|
||||
Connection: [keep-alive]
|
||||
User-Agent: [python-requests/2.18.4]
|
||||
method: GET
|
||||
uri: http://localhost:4000/api/v1/streaming/health
|
||||
response:
|
||||
body: {string: OK}
|
||||
headers:
|
||||
Access-Control-Allow-Headers: ['Authorization, Accept, Cache-Control']
|
||||
Access-Control-Allow-Methods: ['GET, OPTIONS']
|
||||
Access-Control-Allow-Origin: ['*']
|
||||
Connection: [keep-alive]
|
||||
Content-Type: [text/plain]
|
||||
Date: ['Sat, 22 Jun 2019 14:40:35 GMT']
|
||||
Transfer-Encoding: [chunked]
|
||||
X-Powered-By: [Express]
|
||||
X-Request-Id: [93545687-8c80-4295-a7c7-5289fac6e5b3]
|
||||
status: {code: 200, message: OK}
|
||||
version: 1
|
Loading…
Referencia en una nova incidència