Hi,

In test_trust.py, several tests did case sensitive search on the output of
the ipa idrange-show command. This could cause false negatives.

Part of: https://fedorahosted.org/freeipa/ticket/4267

-- 
Tomas Babej
Associate Software Engeneer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org 


>From c8d687b42502d4eda40c75be98bb8a99ace26ecc Mon Sep 17 00:00:00 2001
From: Tomas Babej <tba...@redhat.com>
Date: Wed, 26 Mar 2014 12:34:55 +0100
Subject: [PATCH] ipatests: Do not depend on the case of the attributes when
 testing ID ranges

In test_trust.py, several tests did case sensitive search on the output of
the ipa idrange-show command. This could cause false negatives.

Part of: https://fedorahosted.org/freeipa/ticket/4267
---
 ipatests/test_integration/test_trust.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py
index 4afc13440b0130f3a9cd6d35ac472e853af39b86..95e48dd9c38df24e861f8f78857682899fa7fe30 100644
--- a/ipatests/test_integration/test_trust.py
+++ b/ipatests/test_integration/test_trust.py
@@ -80,8 +80,12 @@ class TestBasicADTrust(ADTrustBase):
         range_name = self.ad.domain.name.upper() + '_id_range'
         result = self.master.run_command(['ipa', 'idrange-show', range_name,
                                           '--all', '--raw'])
-        assert "  ipaRangeType: ipa-ad-trust" in result.stdout_text
-        assert "  ipaIDRangeSize: 200000" in result.stdout_text
+
+        iparangetype_regex = r'ipaRangeType: ipa-ad-trust'
+        iparangesize_regex = r'ipaIDRangeSize: 200000'
+
+        assert re.search(iparangetype_regex, result.stdout_text, re.IGNORECASE)
+        assert re.search(iparangesize_regex, result.stdout_text, re.IGNORECASE)
 
     def test_user_gid_uid_resolution_in_nonposix_trust(self):
         """Check that user has SID-generated UID"""
@@ -120,8 +124,11 @@ class TestPosixADTrust(ADTrustBase):
                                           '--all', '--raw'])
 
         # Check the range type and size
-        assert "  ipaRangeType: ipa-ad-trust-posix" in result.stdout_text
-        assert "  ipaIDRangeSize: 200000" in result.stdout_text
+        iparangetype_regex = r'ipaRangeType: ipa-ad-trust-posix'
+        iparangesize_regex = r'ipaIDRangeSize: 200000'
+
+        assert re.search(iparangetype_regex, result.stdout_text, re.IGNORECASE)
+        assert re.search(iparangesize_regex, result.stdout_text, re.IGNORECASE)
 
     def test_user_uid_gid_resolution_in_posix_trust(self):
         # Check that user has AD-defined UID
-- 
1.8.5.3

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to