mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add some tests
This commit is contained in:
parent
f61ef5318d
commit
e8e55de165
2 changed files with 14 additions and 1 deletions
2
build.sh
2
build.sh
|
|
@ -33,7 +33,7 @@ _davserver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
command__install_tests() {
|
command__install_tests() {
|
||||||
$PIP_INSTALL pytest pytest-xprocess
|
$PIP_INSTALL pytest pytest-xprocess pytest-localserver
|
||||||
_optimize_pip
|
_optimize_pip
|
||||||
_davserver $DAV_SERVER
|
_davserver $DAV_SERVER
|
||||||
[ "$TRAVIS" != "true" ] || $PIP_INSTALL coverage coveralls
|
[ "$TRAVIS" != "true" ] || $PIP_INSTALL coverage coveralls
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
import click
|
import click
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
import pytest
|
import pytest
|
||||||
|
import requests
|
||||||
|
|
||||||
import vdirsyncer.utils as utils
|
import vdirsyncer.utils as utils
|
||||||
from vdirsyncer.utils.vobject import split_collection
|
from vdirsyncer.utils.vobject import split_collection
|
||||||
|
|
||||||
|
|
@ -159,3 +161,14 @@ def test_get_class_init_args_on_storage():
|
||||||
all, required = utils.get_class_init_args(MemoryStorage)
|
all, required = utils.get_class_init_args(MemoryStorage)
|
||||||
assert all == set(['collection', 'read_only', 'instance_name'])
|
assert all == set(['collection', 'read_only', 'instance_name'])
|
||||||
assert not required
|
assert not required
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_verify_fingerprint(httpsserver):
|
||||||
|
httpsserver.serve_content(content='hello', code=200, headers=None)
|
||||||
|
with pytest.raises(requests.exceptions.SSLError) as excinfo:
|
||||||
|
utils.request('GET', httpsserver.url)
|
||||||
|
assert 'certificate verify failed' in str(excinfo.value)
|
||||||
|
utils.request('GET', httpsserver.url, verify=False)
|
||||||
|
with pytest.raises(requests.exceptions.SSLError) as excinfo:
|
||||||
|
utils.request('GET', httpsserver.url, verify=False,
|
||||||
|
verify_fingerprint='ABCD')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue