#50705 Issue: 48851 - Investigate and port TET matching rules filter tests(last test cases for match)
Closed 4 months ago by spichugi. Opened a year ago by aborah.
aborah/389-ds-base last_match  into  master

@@ -385,6 +385,7 @@ 

                    'ÇélIné Ändrè3', 'ÇélIné Ändrè3', 'ÇélIné Ändrè4', 'ÇélIné Ändrè4',

                    'ÇélIné Ändrè5', 'ÇélIné Ändrè5', 'ÇélIné Ändrè6', 'ÇélIné Ändrè6']}]

  

+ 

  LIST_ATTR = [

      ('entryoctetStringMatch0', 'AAAAAAAAAAAAAAE='),

      ('entryoctetStringMatch1', 'AAAAAAAAAAAAAAI='),
@@ -491,31 +492,111 @@ 

      ('entryintegerFirstComponentMatch5', "3")]

  

  

- POSITIVE_VALUES = [

-     ["(attrbitStringMatch='0001'B)", 1],

-     ["(attrgeneralizedTimeMatch=20100218171300Z)", 1],

-     ["(attrcaseExactMatch>=ÇélIné Ändrè)", 5],

-     ["(attrcaseExactMatch:caseExactMatch:=ÇélIné Ändrè)", 1],

-     ["(attrcaseExactIA5Match=Sprain)", 1],

-     ["(attrbooleanMatch=TRUE)", 1],

-     ["(attrcaseIgnoreIA5Match=sprain1)", 1],

-     ["(attrcaseIgnoreMatch=ÇélIné Ändrè1)", 1],

-     ["(attrcaseIgnoreMatch>=ÇélIné Ändrè1)", 6],

-     ["(attrcaseIgnoreListMatch=foo1$bar)", 1],

-     ["(attrobjectIdentifierMatch=1.3.6.1.4.1.1466.115.121.1.15)", 1],

-     ["(attrgeneralizedTimeMatch>=20100218171300Z)", 6],

-     ["(attrdirectoryStringFirstComponentMatch=ÇélIné Ändrè1)", 1],

-     ["(attrobjectIdentifierFirstComponentMatch=1.3.6.1.4.1.1466.115.121.1.15)", 1],

-     ["(attrdistinguishedNameMatch=cn=foo1,cn=bar)", 1],

-     ["(attrintegerMatch=-2)", 1],

-     ["(attrintegerMatch>=-2)", 6],

-     ["(attrintegerFirstComponentMatch=-2)", 1],

-     ["(attruniqueMemberMatch=cn=foo1,cn=bar#'0001'B)", 1],

-     ["(attrnumericStringMatch=00001)", 1],

-     ["(attrnumericStringMatch>=00001)", 6],

-     ["(attrtelephoneNumberMatch=+1 408 555 4798)", 1],

-     ["(attroctetStringMatch=AAAAAAAAAAAAAAE=)", 1],

-     ["(attroctetStringMatch>=AAAAAAAAAAAAAAE=)", 6]]

+ POSITIVE_NEGATIVE_VALUES = [

+     ["(attrbitStringMatch='0001'B)", 1,

+      "(attrbitStringMatch:bitStringMatch:='000100000'B)"],

+     ["(attrgeneralizedTimeMatch=20100218171300Z)", 1,

+      "(attrcaseExactIA5Match=SPRAIN)"],

+     ["(attrcaseExactMatch>=ÇélIné Ändrè)", 5,

+      "(attrcaseExactMatch=ÇéLINé ÄNDRè)"],

+     ["(attrcaseExactMatch:caseExactMatch:=ÇélIné Ändrè)", 1,

+      "(attrcaseExactMatch>=çéliné ändrè)"],

+     ["(attrcaseExactIA5Match=Sprain)", 1,

+      "(attrgeneralizedTimeMatch=20300218171300Z)"],

+     ["(attrbooleanMatch=TRUE)", 1,

+      "(attrgeneralizedTimeMatch>=20300218171300Z)"],

+     ["(attrcaseIgnoreIA5Match=sprain1)", 1,

+      "(attrcaseIgnoreIA5Match=sprain9999)"],

+     ["(attrcaseIgnoreMatch=ÇélIné Ändrè1)", 1,

+      "(attrcaseIgnoreMatch=ÇélIné Ändrè9999)"],

+     ["(attrcaseIgnoreMatch>=ÇélIné Ändrè1)", 6,

+      "(attrcaseIgnoreMatch>=ÇélIné Ändrè9999)"],

+     ["(attrcaseIgnoreListMatch=foo1$bar)", 1,

+      "(attrcaseIgnoreListMatch=foo1$bar$baz$biff)"],

+     ["(attrobjectIdentifierMatch=1.3.6.1.4.1.1466.115.121.1.15)", 1,

+      "(attrobjectIdentifierMatch=1.3.6.1.4.1.1466.115.121.1.15.99999)"],

+     ["(attrgeneralizedTimeMatch>=20100218171300Z)", 6,

+      "(attroctetStringMatch>=AAAAAAAAAAABAQQ=)"],

+     ["(attrdirectoryStringFirstComponentMatch=ÇélIné Ändrè1)", 1,

+      "(attrdirectoryStringFirstComponentMatch=ÇélIné Ändrè9999)"],

+     ["(attrobjectIdentifierFirstComponentMatch=1.3.6.1.4.1.1466.115.121.1.15)", 1,

+      "(attrobjectIdentifierFirstComponentMatch=1.3.6.1.4.1.1466.115.121.1.15.99999)"],

+     ["(attrdistinguishedNameMatch=cn=foo1,cn=bar)", 1,

+      "(attrdistinguishedNameMatch=cn=foo1,cn=bar,cn=baz)"],

+     ["(attrintegerMatch=-2)", 1,

+      "(attrintegerMatch=-20)"],

+     ["(attrintegerMatch>=-2)", 6,

+      "(attrintegerMatch>=20)"],

+     ["(attrintegerFirstComponentMatch=-2)", 1,

+      "(attrintegerFirstComponentMatch=-20)"],

+     ["(attruniqueMemberMatch=cn=foo1,cn=bar#'0001'B)", 1,

+      "(attruniqueMemberMatch=cn=foo1,cn=bar#'00010000'B)"],

+     ["(attrnumericStringMatch=00001)", 1,

+      "(attrnumericStringMatch=000000001)"],

+     ["(attrnumericStringMatch>=00001)", 6,

+      "(attrnumericStringMatch>=01)"],

+     ["(attrtelephoneNumberMatch=+1 408 555 4798)", 1,

+      "(attrtelephoneNumberMatch=+2 408 555 4798)"],

+     ["(attroctetStringMatch=AAAAAAAAAAAAAAE=)", 1,

+      "(attroctetStringMatch=AAAAAAAAAAAAAAEB)"],

+     ["(attroctetStringMatch>=AAAAAAAAAAAAAAE=)", 6,

+      "(attroctetStringMatch>=AAAAAAAAAAABAQE=)"]]

+ 

+ 

+ LIST_EXT = [("(attrbitStringMatch:bitStringMatch:='0001'B)", 1),

+             ("(attrcaseExactIA5Match:caseExactIA5Match:=Sprain)", 1),

+             ("(attrcaseExactMatch:caseExactMatch:=ÇélIné Ändrè)", 1),

+             ("(attrcaseExactMatch:caseExactOrderingMatch:=ÇélIné Ändrè)", 5),

+             ("(attrgeneralizedTimeMatch:generalizedTimeMatch:=20100218171300Z)", 1),

+             ("(attrgeneralizedTimeMatch:generalizedTimeOrderingMatch:=20100218171300Z)", 6),

+             ("(attrbooleanMatch:booleanMatch:=TRUE)", 1),

+             ("(attrcaseIgnoreIA5Match:caseIgnoreIA5Match:=sprain1)", 1),

+             ("(attrcaseIgnoreMatch:caseIgnoreMatch:=ÇélIné Ändrè1)", 1),

+             ("(attrcaseIgnoreMatch:caseIgnoreOrderingMatch:=ÇélIné Ändrè1)", 6),

+             ("(attrcaseIgnoreListMatch:caseIgnoreListMatch:=foo1$bar)", 1),

+             ("(attrobjectIdentifierMatch:objectIdentifierMatch:=1.3.6.1.4.1.1466.115.121.1.15)", 1),

+             ("(attrdirectoryStringFirstComponentMatch:directory"

+              "StringFirstComponentMatch:=ÇélIné Ändrè1)", 1),

+             ("(attrobjectIdentifierFirstComponentMatch:objectIdentifier"

+              "FirstComponentMatch:=1.3.6.1.4.1.1466.115.121.1.15)", 1),

+             ("(attrdistinguishedNameMatch:distinguishedNameMatch:=cn=foo1,cn=bar)", 1),

+             ("(attrintegerMatch:integerMatch:=-2)", 1),

+             ("(attrintegerMatch:integerOrderingMatch:=-2)", 6),

+             ("(attrintegerFirstComponentMatch:integerFirstComponentMatch:=-2)", 1),

+             ("(attruniqueMemberMatch:uniqueMemberMatch:=cn=foo1,cn=bar#'0001'B)", 1),

+             ("(attrnumericStringMatch:numericStringMatch:=00001)", 1),

+             ("(attrnumericStringMatch:numericStringMatch:=00001)", 1),

+             ("(attrtelephoneNumberMatch:telephoneNumberMatch:=+1 408 555 4798)", 1),

+             ("(attroctetStringMatch:octetStringMatch:=AAAAAAAAAAAAAAE=)", 1),

+             ("(attroctetStringMatch:octetStringOrderingMatch:=AAAAAAAAAAAAAAE=)", 6),

+             ("(attrcaseExactMatch=*ÇélIné Ändrè*)", 1),

+             ("(attrcaseExactMatch=ÇélIné Ändrè*)", 1),

+             ("(attrcaseExactMatch=*ÇélIné Ändrè)", 1),

+             ("(attrcaseExactMatch=*é Ä*)", 5),

+             ("(attrcaseExactIA5Match=*Sprain*)", 1),

+             ("(attrcaseExactIA5Match=Sprain*)", 1),

+             ("(attrcaseExactIA5Match=*Sprain)", 1),

+             ("(attrcaseExactIA5Match=*rai*)", 3),

+             ("(attrcaseIgnoreIA5Match=*sprain1*)", 1),

+             ("(attrcaseIgnoreIA5Match=sprain1*)", 1),

+             ("(attrcaseIgnoreIA5Match=*sprain1)", 1),

+             ("(attrcaseIgnoreIA5Match=*rai*)", 6),

+             ("(attrcaseIgnoreMatch=*ÇélIné Ändrè1*)", 1),

+             ("(attrcaseIgnoreMatch=ÇélIné Ändrè1*)", 1),

+             ("(attrcaseIgnoreMatch=*ÇélIné Ändrè1)", 1),

+             ("(attrcaseIgnoreMatch=*é Ä*)", 6),

+             ("(attrcaseIgnoreListMatch=*foo1$bar*)", 1),

+             ("(attrcaseIgnoreListMatch=foo1$bar*)", 1),

+             ("(attrcaseIgnoreListMatch=*foo1$bar)", 1),

+             ("(attrcaseIgnoreListMatch=*1$b*)", 1),

+             ("(attrnumericStringMatch=*00001*)", 1),

+             ("(attrnumericStringMatch=00001*)", 1),

+             ("(attrnumericStringMatch=*00001)", 1),

+             ("(attrnumericStringMatch=*000*)", 6),

+             ("(attrtelephoneNumberMatch=*+1 408 555 4798*)", 1),

+             ("(attrtelephoneNumberMatch=+1 408 555 4798*)", 1),

+             ("(attrtelephoneNumberMatch=*+1 408 555 4798)", 1),

+             ("(attrtelephoneNumberMatch=* 55*)", 6)]

  

  

  def test_matching_rules(topology_st):
@@ -648,18 +729,34 @@ 

          })

  

  

- @pytest.mark.parametrize("attr, value", POSITIVE_VALUES)

- def test_match_count(topology_st, _searches, attr, value):

+ @pytest.mark.parametrize("attr, po_value, ne_attr", POSITIVE_NEGATIVE_VALUES)

+ def test_match_count(topology_st, _searches, attr, po_value, ne_attr):

      """Search for an attribute with that matching rule with an assertion

      value that should match

          :id: 00276180-b902-11e9-bff2-8c16451d917b

          :setup: Standalone

          :steps:

              1. Filter rules as per the condition and assert the no of output.

+             2. Negative filter with no outputs.

          :expected results:

              1. Pass

+             2. Pass

          """

+     cos = CosTemplates(topology_st.standalone, DEFAULT_SUFFIX)

+     assert len(cos.filter(attr)) == po_value

+     assert not cos.filter(ne_attr)

  

+ 

+ @pytest.mark.parametrize("attr, value", LIST_EXT)

+ def test_extensible_search(topology_st, _searches, attr, value):

+     """Match filter and output.

+         :id: abe3e6dd-9ecc-11e8-adf0-8c16451d917c

+         :setup: Standalone

+         :steps:

+             1. Filer output should match the exact value given.

+         :expected results:

+             1. Pass

+     """

      cos = CosTemplates(topology_st.standalone, DEFAULT_SUFFIX)

      assert len(cos.filter(attr)) == value

  

Bug Description: Investigate and port TET matching rules filter tests(last test cases for match)

Relates: https://pagure.io/389-ds-base/issue/48851

Author: aborah

Reviewed by: ???

Hmmm I'm not sure about this parameterisation, but I think @spichugi may have more comments on it?

@firstyear I think it follows the previous logic @aborah created before.
So as long as it runs through all of these filters I think we are kind of okay...

Anuj, could you please rebase it and I'll run it once again on a fresh master.

rebased onto 6ee5725fb385470ddc6816c26da0f6021d7eddd8

a year ago

rebased onto eeeeba09b5bd341be53ddb1efeeaad1b84859718

a year ago

@firstyear I think it follows the previous logic @aborah created before.
So as long as it runs through all of these filters I think we are kind of okay...
Anuj, could you please rebase it and I'll run it once again on a fresh master.

Done

rebased onto 483e9bd358867a0e2811cd93cd61fa6de057dded

a year ago

rebased onto 85a26d9ffb8ff05423b37f7f643733a5b41f407a

a year ago

rebased onto 8d42434

a year ago

Pull-Request has been merged by vashirov

a year ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3760

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

4 months ago
Metadata