This commit is contained in:
Markus Unterwaditzer 2014-04-11 15:49:15 +02:00
parent 70b446e673
commit 65e6397806
9 changed files with 12 additions and 11 deletions

View file

@ -9,7 +9,7 @@
from vdirsyncer.storage.base import Item from vdirsyncer.storage.base import Item
import vdirsyncer.exceptions as exceptions import vdirsyncer.exceptions as exceptions
from .. import assert_item_equals, normalize_item from .. import assert_item_equals
import random import random
import pytest import pytest

View file

@ -15,7 +15,6 @@
import sys import sys
import os import os
import urlparse import urlparse
import shutil
import pytest import pytest
from werkzeug.test import Client from werkzeug.test import Client
@ -75,8 +74,8 @@ def do_the_radicale_dance(tmpdir):
radicale.config.set('rights', 'type', 'owner_only') radicale.config.set('rights', 'type', 'owner_only')
radicale.config.set('auth', 'type', 'http') radicale.config.set('auth', 'type', 'http')
import radicale.auth.http import radicale.auth.http
def is_authenticated(user, password): def is_authenticated(user, password):
assert user == 'bob' and password == 'bob' assert user == 'bob' and password == 'bob'
return True return True
@ -121,7 +120,6 @@ class ServerMixin(object):
r.status_code = wr.status_code r.status_code = wr.status_code
return r return r
monkeypatch.setattr('requests.adapters.HTTPAdapter.send', send) monkeypatch.setattr('requests.adapters.HTTPAdapter.send', send)
def get_storage_args(self, collection='test'): def get_storage_args(self, collection='test'):

View file

@ -44,6 +44,7 @@ class TestFilesystemStorage(StorageTests):
def test_broken_data(self, tmpdir): def test_broken_data(self, tmpdir):
s = self.storage_class(str(tmpdir), '.txt') s = self.storage_class(str(tmpdir), '.txt')
class BrokenItem(object): class BrokenItem(object):
raw = b'Ц, Ш, Л, ж, Д, З, Ю' raw = b'Ц, Ш, Л, ж, Д, З, Ю'
uid = 'jeezus' uid = 'jeezus'

View file

@ -7,9 +7,8 @@
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
''' '''
from .. import assert_item_equals
from textwrap import dedent from textwrap import dedent
from vdirsyncer.storage.http import HttpStorage, Item from vdirsyncer.storage.http import HttpStorage
from requests import Response from requests import Response

View file

@ -9,7 +9,7 @@
from textwrap import dedent from textwrap import dedent
import vdirsyncer.cli as cli import vdirsyncer.cli as cli
import vdirsyncer.exceptions as exceptions
def test_load_config(tmpdir, monkeypatch): def test_load_config(tmpdir, monkeypatch):
f = tmpdir.join('test.cfg') f = tmpdir.join('test.cfg')
@ -54,6 +54,7 @@ def test_load_config(tmpdir, monkeypatch):
assert errors[0].startswith('Unknown section') assert errors[0].startswith('Unknown section')
assert 'bogus' in errors[0] assert 'bogus' in errors[0]
def test_storage_instance_from_config(monkeypatch): def test_storage_instance_from_config(monkeypatch):
def lol(**kw): def lol(**kw):
assert kw == {'foo': 'bar', 'baz': 1} assert kw == {'foo': 'bar', 'baz': 1}

View file

@ -35,6 +35,9 @@ def test_parse_options():
assert a == expected assert a == expected
for key in a: for key in a:
# Yes, we want a very strong typecheck here, because we actually have
# to differentiate between bool and int, and in Python 2, bool is a
# subclass of int.
assert type(a[key]) is type(expected[key]) assert type(a[key]) is type(expected[key])

View file

@ -35,8 +35,8 @@ class Storage(object):
- HREF: String; Per-storage identifier of item, might be UID. The reason - HREF: String; Per-storage identifier of item, might be UID. The reason
items aren't just referenced by their UID is because the CalDAV and items aren't just referenced by their UID is because the CalDAV and
CardDAV specifications make this imperformant to implement. CardDAV specifications make this imperformant to implement.
- ETAG: String; Checksum of item, or something similar that changes when the - ETAG: String; Checksum of item, or something similar that changes when
item does. the item does.
Strings can be either unicode strings or bytestrings. If bytestrings, an Strings can be either unicode strings or bytestrings. If bytestrings, an
ASCII encoding is assumed. ASCII encoding is assumed.

View file

@ -11,7 +11,7 @@ from .base import Storage, Item
from .http import prepare_auth, prepare_verify, USERAGENT from .http import prepare_auth, prepare_verify, USERAGENT
from .. import exceptions from .. import exceptions
from .. import log from .. import log
from ..utils import request from ..utils import request, get_password
import requests import requests
import datetime import datetime
import urlparse import urlparse

View file

@ -8,7 +8,6 @@
:license: MIT, see LICENSE for more details. :license: MIT, see LICENSE for more details.
''' '''
import requests
import urlparse import urlparse
import hashlib import hashlib
from .base import Storage, Item from .base import Storage, Item