From 21aea26c704c1cf5baffc93ae5f25d3ca4c774c2 Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Thu, 19 May 2022 14:06:15 +0200 Subject: [PATCH] carddav: don't filter properties in test queries As is, the tests in `match_test.go` test wrong behavior. They request "partial retrieval" (i.e. filtering of returned properties), but compare the returned result to the original input. They essentially rely on the fact that property filtering is currently not implemented. To fix this, simply make all existing test queries request all properties. If property filtering gets implemented (correctly), the tests will then continue to work. New tests can be added for testing the property filtering itself. --- carddav/match_test.go | 42 +++++++----------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/carddav/match_test.go b/carddav/match_test.go index e42487e..9451ffe 100644 --- a/carddav/match_test.go +++ b/carddav/match_test.go @@ -64,11 +64,7 @@ END:VCARD`) name: "no-limit-query", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, PropFilters: []PropFilter{ { @@ -84,11 +80,7 @@ END:VCARD`) name: "limit-1-query", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, Limit: 1, PropFilters: []PropFilter{ @@ -105,11 +97,7 @@ END:VCARD`) name: "limit-4-query", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, Limit: 4, PropFilters: []PropFilter{ @@ -126,11 +114,7 @@ END:VCARD`) name: "email-match", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, PropFilters: []PropFilter{ { @@ -146,11 +130,7 @@ END:VCARD`) name: "email-match-any", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, PropFilters: []PropFilter{ { @@ -169,11 +149,7 @@ END:VCARD`) name: "email-match-all", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, PropFilters: []PropFilter{{ Name: vcard.FieldEmail, @@ -189,11 +165,7 @@ END:VCARD`) name: "email-no-match", query: &AddressBookQuery{ DataRequest: AddressDataRequest{ - Props: []string{ - vcard.FieldFormattedName, - vcard.FieldEmail, - vcard.FieldUID, - }, + AllProp: true, }, PropFilters: []PropFilter{ {