andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0014-Ticket-47880-CI-test-added-test-cases-for-ticket-478.patch

f92ce9
From 85e5ebbddf2a9b39376b7bc3b1529d6f170b907e Mon Sep 17 00:00:00 2001
f92ce9
From: Noriko Hosoi <nhosoi@redhat.com>
f92ce9
Date: Thu, 25 Sep 2014 14:43:16 -0700
f92ce9
Subject: [PATCH 14/14] Ticket 47880 - CI test: added test cases for ticket
f92ce9
 47880
f92ce9
f92ce9
Description: Ticket #47880 - provide enabled ciphers as search result
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47880
f92ce9
(cherry picked from commit ce7378990855abe1a5b52cd4fbe78ffc33365dcb)
f92ce9
(cherry picked from commit b922e5d8387535a8bd71bbcea821ba08608d27c2)
f92ce9
---
f92ce9
 dirsrvtests/tickets/ticket47838_test.py | 46 ++++++++++++++++++++++++++++++++-
f92ce9
 1 file changed, 45 insertions(+), 1 deletion(-)
f92ce9
f92ce9
diff --git a/dirsrvtests/tickets/ticket47838_test.py b/dirsrvtests/tickets/ticket47838_test.py
f92ce9
index 1575376..c98c36e 100644
f92ce9
--- a/dirsrvtests/tickets/ticket47838_test.py
f92ce9
+++ b/dirsrvtests/tickets/ticket47838_test.py
f92ce9
@@ -216,6 +216,24 @@ def test_ticket47838_init(topology):
f92ce9
                                               'nsSSLToken': 'internal (software)',
f92ce9
                                               'nsSSLActivation': 'on'})))
f92ce9
 
f92ce9
+def comp_nsSSLEnableCipherCount(topology, ecount):
f92ce9
+    """
f92ce9
+    Check nsSSLEnabledCipher count with ecount
f92ce9
+    """
f92ce9
+    log.info("Checking nsSSLEnabledCiphers...")
f92ce9
+    msgid = topology.standalone.search_ext(ENCRYPTION_DN, ldap.SCOPE_BASE, 'cn=*', ['nsSSLEnabledCiphers'])
f92ce9
+    enabledciphercnt = 0
f92ce9
+    rtype, rdata, rmsgid = topology.standalone.result2(msgid)
f92ce9
+    topology.standalone.log.info("%d results" % len(rdata))
f92ce9
+
f92ce9
+    topology.standalone.log.info("Results:")
f92ce9
+    for dn, attrs in rdata:
f92ce9
+        topology.standalone.log.info("dn: %s" % dn)
f92ce9
+        if attrs.has_key('nsSSLEnabledCiphers'):
f92ce9
+            enabledciphercnt = len(attrs['nsSSLEnabledCiphers'])
f92ce9
+    topology.standalone.log.info("enabledCipherCount: %d" % enabledciphercnt)
f92ce9
+    assert ecount == enabledciphercnt
f92ce9
+
f92ce9
 def test_ticket47838_run_0(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: +all
f92ce9
@@ -248,6 +266,8 @@ def test_ticket47838_run_0(topology):
f92ce9
     log.info("Weak ciphers: %d" % wcount)
f92ce9
     assert wcount <= 29
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_1(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: +all
f92ce9
@@ -287,6 +307,8 @@ def test_ticket47838_run_1(topology):
f92ce9
     log.info("Weak ciphers: %d" % wcount)
f92ce9
     assert wcount <= 29
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_2(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: +rsa_aes_128_sha,+rsa_aes_256_sha
f92ce9
@@ -316,6 +338,8 @@ def test_ticket47838_run_2(topology):
f92ce9
     assert ecount == 2
f92ce9
     assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_3(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: -all
f92ce9
@@ -344,6 +368,8 @@ def test_ticket47838_run_3(topology):
f92ce9
     log.info("Disabling SSL message?: %s" % disabledmsg.readline())
f92ce9
     assert disabledmsg != ''
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_4(topology):
f92ce9
     """
f92ce9
     Check no nsSSL3Ciphers
f92ce9
@@ -377,6 +403,8 @@ def test_ticket47838_run_4(topology):
f92ce9
     log.info("Weak ciphers in the default setting: %d" % wcount)
f92ce9
     assert wcount == 0
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_5(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: default
f92ce9
@@ -410,6 +438,8 @@ def test_ticket47838_run_5(topology):
f92ce9
     log.info("Weak ciphers in the default setting: %d" % wcount)
f92ce9
     assert wcount == 0
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_6(topology):
f92ce9
     """
f92ce9
     Check nssSSL3Chiphers: +all,-rsa_rc4_128_md5
f92ce9
@@ -441,6 +471,8 @@ def test_ticket47838_run_6(topology):
f92ce9
     assert ecount == (plus_all_ecount_noweak - 1)
f92ce9
     assert dcount == (plus_all_dcount_noweak + 1)
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_7(topology):
f92ce9
     """
f92ce9
     Check nssSSL3Chiphers: -all,+rsa_rc4_128_md5
f92ce9
@@ -470,6 +502,8 @@ def test_ticket47838_run_7(topology):
f92ce9
     assert ecount == 1
f92ce9
     assert dcount == (plus_all_ecount + plus_all_dcount - ecount)
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_8(topology):
f92ce9
     """
f92ce9
     Check nsSSL3Ciphers: default + allowWeakCipher: off
f92ce9
@@ -503,6 +537,8 @@ def test_ticket47838_run_8(topology):
f92ce9
     log.info("Weak ciphers in the default setting: %d" % wcount)
f92ce9
     assert wcount == 0
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_9(topology):
f92ce9
     """
f92ce9
     Check no nsSSL3Ciphers
f92ce9
@@ -537,6 +573,8 @@ def test_ticket47838_run_9(topology):
f92ce9
     log.info("Weak ciphers in the default setting: %d" % wcount)
f92ce9
     assert wcount == 11
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_10(topology):
f92ce9
     """
f92ce9
     Check nssSSL3Chiphers: -TLS_RSA_WITH_NULL_MD5,+TLS_RSA_WITH_RC4_128_MD5,
f92ce9
@@ -579,6 +617,8 @@ def test_ticket47838_run_10(topology):
f92ce9
 
f92ce9
     topology.standalone.log.info("ticket47838 was successfully verified.");
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, ecount)
f92ce9
+
f92ce9
 def test_ticket47838_run_11(topology):
f92ce9
     """
f92ce9
     Check nssSSL3Chiphers: +fortezza
f92ce9
@@ -603,6 +643,8 @@ def test_ticket47838_run_11(topology):
f92ce9
         log.info("Expected error message was not found")
f92ce9
         assert False
f92ce9
 
f92ce9
+    comp_nsSSLEnableCipherCount(topology, 0)
f92ce9
+
f92ce9
 def test_ticket47838_run_last(topology):
f92ce9
     """
f92ce9
     Check nssSSL3Chiphers: all <== invalid value
f92ce9
@@ -627,7 +669,9 @@ def test_ticket47838_run_last(topology):
f92ce9
         log.info("Expected error message was not found")
f92ce9
         assert False
f92ce9
 
f92ce9
-    topology.standalone.log.info("ticket47838 was successfully verified.");
f92ce9
+    comp_nsSSLEnableCipherCount(topology, 0)
f92ce9
+
f92ce9
+    topology.standalone.log.info("ticket47838, 47880, 47908 were successfully verified.");
f92ce9
 
f92ce9
 def test_ticket47838_final(topology):
f92ce9
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
f92ce9
-- 
f92ce9
1.9.3
f92ce9