add a test for instance

This commit is contained in:
codl 2017-11-27 02:37:02 +01:00
pare 4b60a0d3cf
commit d09d27cdd2
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 6CD7C8891ED1233A
S'han modificat 2 arxius amb 38 adicions i 0 eliminacions

Veure arxiu

@ -0,0 +1,27 @@
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
Connection: [keep-alive]
User-Agent: [python-requests/2.18.4]
method: GET
uri: http://localhost:3000/api/v1/instance/
response:
body: {string: '{"uri":"localhost:3000","title":"Mastodon","description":"","email":"","version":"2.0.0","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":2,"status_count":22,"domain_count":1},"thumbnail":null}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Type: [application/json; charset=utf-8]
ETag: [W/"c5c80940c21c432b7b5c69bcf67a8ff3"]
Transfer-Encoding: [chunked]
Vary: ['Accept-Encoding, Origin']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [23b994ca-448c-42a7-a107-c39e58742541]
X-Runtime: ['0.046093']
X-XSS-Protection: [1; mode=block]
content-length: ['213']
status: {code: 200, message: OK}
version: 1

11
tests/test_instance.py Normal file
Veure arxiu

@ -0,0 +1,11 @@
from .fixtures import *
import pytest
@pytest.mark.vcr()
def test_instance(mastodon):
instance = mastodon.instance()
assert isinstance(instance, dict) # hehe, instance is instance
expected_keys = set(('description', 'email', 'title', 'uri', 'version', 'urls'))
assert set(instance.keys()) >= expected_keys