add tests for domain block methods

This commit is contained in:
codl 2017-11-30 01:29:20 +01:00
pare f9a52029fc
commit 2b40089810
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 6CD7C8891ED1233A
S'han modificat 3 arxius amb 96 adicions i 0 eliminacions

Veure arxiu

@ -0,0 +1,56 @@
interactions:
- request:
body: domain=example.com
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
Connection: [keep-alive]
Content-Length: ['18']
Content-Type: [application/x-www-form-urlencoded]
User-Agent: [python-requests/2.18.4]
method: POST
uri: http://localhost:3000/api/v1/domain_blocks
response:
body: {string: '{}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Type: [application/json; charset=utf-8]
ETag: [W/"fe7f6d5b13e22f37fb57de6e31e0ef11"]
Transfer-Encoding: [chunked]
Vary: ['Accept-Encoding, Origin']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [cb5c8333-c6bd-41c3-bdfd-d6c974ea7d2b]
X-Runtime: ['0.059619']
X-XSS-Protection: [1; mode=block]
content-length: ['2']
status: {code: 200, message: OK}
- request:
body: domain=example.com
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
Connection: [keep-alive]
Content-Length: ['18']
Content-Type: [application/x-www-form-urlencoded]
User-Agent: [python-requests/2.18.4]
method: DELETE
uri: http://localhost:3000/api/v1/domain_blocks
response:
body: {string: '{}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Type: [application/json; charset=utf-8]
ETag: [W/"fe7f6d5b13e22f37fb57de6e31e0ef11"]
Transfer-Encoding: [chunked]
Vary: ['Accept-Encoding, Origin']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [56395cbf-814c-4e57-97fd-2c44592211aa]
X-Runtime: ['0.019281']
X-XSS-Protection: [1; mode=block]
content-length: ['2']
status: {code: 200, message: OK}
version: 1

Veure arxiu

@ -0,0 +1,27 @@
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
Connection: [keep-alive]
User-Agent: [python-requests/2.18.4]
method: GET
uri: http://localhost:3000/api/v1/domain_blocks
response:
body: {string: '[]'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Type: [application/json; charset=utf-8]
ETag: [W/"4fdefc2aac1c40f3865259d9f3074aec"]
Transfer-Encoding: [chunked]
Vary: ['Accept-Encoding, Origin']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [d7fec252-2898-46a1-a538-0e5ecda88fa8]
X-Runtime: ['0.032291']
X-XSS-Protection: [1; mode=block]
content-length: ['2']
status: {code: 200, message: OK}
version: 1

Veure arxiu

@ -0,0 +1,13 @@
import pytest
@pytest.mark.vcr()
def test_domain_blocks(api):
blocks = api.domain_blocks()
assert isinstance(blocks, list)
@pytest.mark.vcr()
def test_domain_block_unblock(api):
api.domain_block('example.com')
api.domain_unblock('example.com')