-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support addressbook-query. Fixes #143
- Loading branch information
Showing
6 changed files
with
86 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ def test_suite(): | |
names = [ | ||
"api", | ||
"caldav", | ||
"carddav", | ||
"config", | ||
"icalendar", | ||
"store", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Xandikos | ||
# Copyright (C) 2022 Jelmer Vernooij <[email protected]>, et al. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; version 3 | ||
# of the License or (at your option) any later version of | ||
# the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
# MA 02110-1301, USA. | ||
|
||
import unittest | ||
|
||
from ..carddav import apply_filter, NAMESPACE | ||
from ..vcard import VCardFile | ||
from ..webdav import ET | ||
from .test_vcard import EXAMPLE_VCARD1 | ||
|
||
|
||
class TestApplyFilter(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.file = VCardFile([EXAMPLE_VCARD1], "text/vcard") | ||
|
||
def get_content_type(self): | ||
return "text/vcard" | ||
|
||
def test_apply_filter(self): | ||
el = ET.Element("{%s}filter" % NAMESPACE) | ||
el.set("test", "anyof") | ||
pf = ET.SubElement(el, "{%s}prop-filter" % NAMESPACE) | ||
pf.set("name", "FN") | ||
tm = ET.SubElement(pf, "{%s}text-match" % NAMESPACE) | ||
tm.set("collation", "i;unicode-casemap") | ||
tm.set("match-type", "contains") | ||
tm.text = "Jeffrey" | ||
self.assertTrue(apply_filter(el, self)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters