Exemple #1
0
    def test_specialchars(self, monkeypatch, requires_collections, get_storage_args, get_item):
        if getattr(self, "dav_server", "") == "radicale":
            pytest.skip("Radicale is fundamentally broken.")

        monkeypatch.setattr("vdirsyncer.utils.generate_href", lambda x: x)

        uid = u"test @ foo ät bar град сатану"
        collection = "test @ foo ät bar"

        s = self.storage_class(**get_storage_args(collection=collection))
        item = get_item(uid=uid)

        href, etag = s.upload(item)
        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        (href2, etag2), = s.list()
        assert etag2 == etag

        # https://github.com/owncloud/contacts/issues/581
        assert href2.replace("%2B", "%20") == href

        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        assert collection in urlunquote(s.collection)
        if self.storage_class.storage_name.endswith("dav"):
            assert urlquote(uid, "/@:") in href
Exemple #2
0
    def test_specialchars(self, monkeypatch, requires_collections,
                          get_storage_args, get_item):
        if getattr(self, 'dav_server', '') == 'radicale':
            pytest.xfail('Radicale is fundamentally broken.')

        monkeypatch.setattr('vdirsyncer.utils.generate_href', lambda x: x)

        uid = u'test @ foo ät bar град сатану'
        collection = 'test @ foo ät bar'

        s = self.storage_class(**get_storage_args(collection=collection))
        item = get_item(uid=uid)

        href, etag = s.upload(item)
        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        (href2, etag2), = s.list()
        assert etag2 == etag

        # https://github.com/owncloud/contacts/issues/581
        assert href2.replace('%2B', '%20') == href

        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        assert collection in urlunquote(s.collection)
        if self.storage_class.storage_name.endswith('dav'):
            assert urlquote(uid, '/@:') in href
Exemple #3
0
    def test_specialchars(self, monkeypatch, requires_collections,
                          get_storage_args, get_item):
        if getattr(self, 'dav_server', '') == 'radicale':
            pytest.skip('Radicale is fundamentally broken.')

        monkeypatch.setattr('vdirsyncer.utils.generate_href', lambda x: x)

        uid = u'test @ foo ät bar град сатану'
        collection = 'test @ foo ät bar'

        s = self.storage_class(**get_storage_args(collection=collection))
        item = get_item(uid=uid)

        href, etag = s.upload(item)
        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        (href2, etag2), = s.list()
        assert etag2 == etag

        # https://github.com/owncloud/contacts/issues/581
        assert href2.replace('%2B', '%20') == href

        item2, etag2 = s.get(href)
        assert etag2 == etag
        assert_item_equals(item2, item)

        assert collection in urlunquote(s.collection)
        if self.storage_class.storage_name.endswith('dav'):
            assert urlquote(uid, '/@:') in href
Exemple #4
0
        def inner(collection='test'):
            url = 'http://127.0.0.1/bob/'
            if collection is not None:
                collection += self.storage_class.fileext
                url = url.rstrip('/') + '/' + urlquote(collection)

            rv = {'url': url, 'username': '******', 'password': '******',
                  'collection': collection}

            if collection is not None:
                s = self.storage_class(**rv)
                s.delete(*s.upload(get_item()))

            return rv
Exemple #5
0
        def inner(collection='test'):
            url = 'http://127.0.0.1/bob/'
            if collection is not None:
                collection += self.storage_class.fileext
                url = url.rstrip('/') + '/' + urlquote(collection)

            rv = {
                'url': url,
                'username': '******',
                'password': '******',
                'collection': collection
            }

            if collection is not None:
                s = self.storage_class(**rv)
                s.delete(*s.upload(get_item()))

            return rv